[OS X TeX] Search with .* but how to replace?

Alain Schremmer schremmer.alain at gmail.com
Sun Apr 27 04:18:07 CEST 2014


On Apr 26, 2014, at 1:00 PM, Herbert Schulz wrote:

> With the default Ruby set as the regex language:
>
> Find: \\NewTerm{(.*)}
>
> Replace: \\texbd{\1}\\index{\1}
>
> Just like \( and \) you've got to quote \, i.e., \\, in the Find  
> section to get the character \.


On Apr 26, 2014, at 9:53 PM, Paul McCann wrote:

> with "Grep" ticked in TextWrangler...
>
> Find:   \\NewTerm{(.*?)}
>
> Replace:   \\textbf{\1}\\index{\1}
>
> Backslash is an escaping character in regular expressions, so to find
> a literal backslash you need to double it. The parentheses around the
> .*? capture the (minimal) contents inside the curly brackets and make
> it available in the replacement field via   \1.

It works! I mean, it really works!

Amazed and grateful regards
--schremmer



More information about the macostex-archives mailing list