[OS X TeX] Replace \f{x} by \g{x}\h{x}

Alain Schremmer schremmer.alain at gmail.com
Fri May 1 16:43:53 CEST 2015


On May 1, 2015, at 9:54 AM, Andrew Miller wrote:

> If you want to replace \f{stuff} with \g{stuff}\h{stuff} and  
> \f{other stuff} with \g{other stuff}\h{other stuff} you could use  
> find and replace in BBEdit or TextWrangler with Grep where the  
> search string is a regex pattern:
>
> \\f\{([^\}]*)\}
>
> and the replacement is
>
> \\g{\1}\\h{\1}
>
> The pattern ([^\}]*) captures the content inside the curly braces  
> and the \1 pastes it in your \g and \h commands.
>
> Grep needs to be checked in the Find dialog for this to work.

(1) I duly noted that my question was ill-posed.

(2) TextWrangler did what you said and, of course, it did exactly what  
I wanted.

(3) My question remains: would you know of a tutorial that this grep- 
challenged person could learn from instead of asking off-topic  
questions? (Not that I do not appreciate not having to learn grep.)

(4) In any case, this (old) person is immensely grateful for the very  
large amount of time he will be saving using this grep and Multi-File  
Search to correct something idiotic he did repeatedly across many long  
files.

Very best regards,
--schremmer



More information about the macostex-archives mailing list