From the comments, here's the regex I propose:
(My_Function\((?:[^,']+|("|')(?:(?!\2).)*\2), ')('\))
Breakdown:
( # Open 1st Capture group
My_Function\( # Match My_Function(
(?:
[^,']+ # Match any non comma/quote characters (for numeric param)
| # Or
("|') # A quote stored in 2nd Capture group
(?:(?!\2).)* # Any character except the quote that matched
\2 # The quote that matched
)
, ' # Match a comma, a space and a single quote
) # End 1st Capture group
( # Open 3rd Capture group
'\) # Match single quote and )
) # Close 2nd Capture group
Implementing that in C# will be something a bit like this:
Regex regex = new Regex(@"(My_Function\((?:[^,']+|(""|')(?:(?!\2).)*\2), ')('\))");
str = regex.Replace(text, "$1SOMENEWVALUE$3");
Where text
contains the page.