Page 1 of 1

BUG: Replacement group should ignore consecutive digits

Posted: Mon May 18, 2015 11:51 am
by SpringwellJames
If you enter a replacement string along the lines of $12$2 the output should be the first matched group followed by a 2 then the second matched group, but it is actually $12 followed by the second matched group. TextCrawler is incorrectly parsing the replacement string, presumably treating the $12 as group 12 rather than group 1 followed by a completely un-related digit 2.

Re: BUG: Replacement group should ignore consecutive digits

Posted: Tue May 19, 2015 10:53 am
by DigitalVolcano
I think this is by design in the .NET regular expression engine.

More info here:
https://msdn.microsoft.com/en-us/librar ... x#Numbered


You can avoid this problem by putting braces around the group number:

Code: Select all

${1}2${2}
hope this helps!

Re: BUG: Replacement group should ignore consecutive digits

Posted: Thu May 28, 2015 1:42 pm
by SpringwellJames
Yes, the braces fix it.

Thanks