Help with regex in VS2008
-
I am trying to replace
if(watever)
somecode;with
if(watever)
{
somecode;
}(if\([^`]*\))([ \n])([^`]*[;]) This regex finds out all such if blocks but when I try to replace \3 with {\3}, I get nothing; meaning \1, \2, \3 are just empty. \0 has value and it is equal to the complete string found. I expect \1 = (if\([^`]*\)) \2 = ([ \n]) \3 = ([^`]*[;]) It may be obvious by now that this is the first time I am using regex. Please suggest.
-
I am trying to replace
if(watever)
somecode;with
if(watever)
{
somecode;
}(if\([^`]*\))([ \n])([^`]*[;]) This regex finds out all such if blocks but when I try to replace \3 with {\3}, I get nothing; meaning \1, \2, \3 are just empty. \0 has value and it is equal to the complete string found. I expect \1 = (if\([^`]*\)) \2 = ([ \n]) \3 = ([^`]*[;]) It may be obvious by now that this is the first time I am using regex. Please suggest.