[OS X TeX] Replace \f{x} by \g{x}\h{x}
Alain Schremmer
schremmer.alain at gmail.com
Fri May 1 14:22:15 EDT 2015
On May 1, 2015, at 11:35 AM, Andrew Miller wrote:
>
>> On May 1, 2015, at 10:43 AM, Alain Schremmer <schremmer.alain at gmail.com
>> > wrote:
>>
>>
>> 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
>
> Whenever I have a question on regular expressions or grep I usually
> look through:
> http://www.regular-expressions.info/
> There are tutorials, examples and reference info.
I shall look into it.
Once again, very grateful regards
--schremmer
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://email.esm.psu.edu/pipermail/macosx-tex/attachments/20150501/02360e8b/attachment.html>
More information about the MacOSX-TeX
mailing list