by Jim Bretti » Wed Jul 27, 2011 9:43 am
Along with the usual $1, $2, etc, you can use these in the replacement string:
$0 - inserts the entire match
<SubStrName> - inserts a captured substring with the name 'SubStrName'.
An example of using <SubStrName> is something like this ... say you need to fix the pronunciation of numbers like $34.23 to read as 34 dollars and 23 cents. You could do it like this:
Regular Expression: \$(?<Dollars>\d+)\.(?<Cents>\d\d)
Pronounce as: $<Dollars> dollars and $<Cents> cents
instead of
Pronounce as: $1 dollars and $2 cents
Basically all this does is let you label the captured substrings so you don't need to rely on $1, $2 etc. It could make a complex expression easier to edit later, since the replacement string does not depend on $1 $2 $3 ordering.
Those are the only other substring replacement variables I know of ... if I run across anything like the ones you mentioned in the original post I'll post something here.