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

Paul McCann paul.mccann at adelaide.edu.au
Sat Apr 26 21:53:51 EDT 2014


Hi Alain,

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.

Cheers,
Paul


More information about the MacOSX-TeX mailing list