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

Michael Welsh yomcat at yomcat.geek.nz
Thu Apr 24 20:33:18 EDT 2014


On 25/04/2014, at 1157, Alain Schremmer <schremmer.alain at gmail.com> wrote:
> 
> I am trying to replace, say, f(x) by g(x)h(x) where x can be any string.
> 
> In OgreKit, f(.*) finds the occurrences of f(x) which it selects in its entirety but I was not able to find on google how then to let it replace it by g(x)h(x).
> 
> Hopeful regards
> --schremmer


As long as x doesn't contain any (), the following works:

Set search syntax to Perl (click on more options) and escape character to \.

Then search
f\((.*?)\)

and replace
g(\1)h(\1)

For a good place to read about this, I suggest the TextWrangler (free from the App Store) help.

Michael


More information about the MacOSX-TeX mailing list