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

Paul McCann paul.mccann at adelaide.edu.au
Sun Apr 27 03:53:51 CEST 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 macostex-archives mailing list