Re: Replacing text via code



Roger,

The parens around the first "([0-9])" is a group (group 1). The parens
around the second "([0-9])" is a group (group 2). In the replace with field
you are putting back the found content of group 1 "\1" the en dash "^=" and
the content of found group 2 "\2"

The a description of most of the special wildcard codes can be found in Word
Help. Here is an excellent reference by fellow MVP Graham Mayor:
http://www.gmayor.com/replace_using_wildcards.htm


--
Greg Maxey/Word MVP
See:
http://gregmaxey.mvps.org/word_tips.htm
For some helpful tips using Word.

Roger Spencelayh wrote:
> In article <1116265408.725727.263740@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>,
> Greg wrote:
>> Something like:
>> <Snip Code>
>
> Thanks for that Greg. Works great.
>
> I follow it down to the line .Replacement.Text = "\1^=\2"
>
> What do the \1 and \2 mean and how do I find out about these codes? Is
> this something specific to Regular Expressions or is it part of the
> Word syntax?


.