0

I have the following line

(textMsg).Style.set_BackgroundColor(Color.FromArgb(0, 0, 0));

and what I want to get is

(textMsg).Style.BackgroundColor = Color.FromArgb(0, 0, 0);

i tried with the following regEx pattern but with no luck

set_(.*)\((([^()]*|(?R))*)\)

i would appreciate any suggestion.

Thanks

1
  • (@R) is a Perl/PCRE-specific recurse-whole-pattern expression. .NET also handles recursion but uses a different syntax. See: regex embedded {{ matching and substitute parentheses for curly braces. Commented Aug 28, 2013 at 14:29

1 Answer 1

0

You could try this instead:

set_([^(]*)\((.*)\)

This captures the property name after set_ in group $1 and anything between the ( and ) of the method call into group `$2, so you can use a replacement string like this:

$1 = $2

Regex 101 Demo

Your expression is invalid and won't compile because you have unbalanced parentheses and un-recongnized tokens.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.