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

Herbert Schulz herbs at wideopenwest.com
Fri Apr 25 02:38:26 CEST 2014


On Apr 24, 2014, at 6:57 PM, 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

Howdy,

I'm FAR from a regex guru but I suspect you'll need something like

Find: f\((.*)\)

Replace: g(\1)h(\1)

Note: (...) has a special meaning and the text inside the ( and ) is saved. The first set gives rise to \1, the second set \2, etc. To get a standard meaning for ( and ) in the Find part you need to quote them; i.e., place a \ before them, hence \( and \).

Good Luck,

Herb Schulz
(herbs at wideopenwest dot com)






More information about the macostex-archives mailing list