[OS X TeX] Search with .* but how to replace?
ross.moore at mq.edu.au
Fri Apr 25 05:05:24 EDT 2014
On 25/04/2014, at 10:54, Herbert Schulz <herbs at wideopenwest.com> wrote:
> . I thought that Perl regex used $1, etc., not \1, etc., but what do I know.
You are not wrong.
My understanding of Perl is that $1 is set for the replacement text only,
whereas \1 is set as soon as the match is made, so that it can be used also later in the pattern.
e.g. ([xyz]).*\1 will match x ... x or y ... y or z ... z , but store only the x/y/z in $1 .
Presumably \1 is still set for the replacement text.
> Good Luck,
> Herb Schulz
> (herbs at wideopenwest dot com)
Hope this helps,
More information about the MacOSX-TeX