[OS X TeX] Regular Expression needed...

Herbert Schulz herbs at wideopenwest.com
Mon Nov 8 02:30:23 CET 2010


On Nov 7, 2010, at 5:33 PM, Gary L. Gray wrote:

> On Nov 7, 2010, at 6:06 PM, Herbert Schulz wrote:
> 
>> Can someone supply a regex that will find repeated words (e.g., repeated repeated) in a file? This is for use with TeXShop's OgreKit Find. It would also be nice to be able to have a replace regex to leave only one of the repeats.
> 
> \b([a-z]+) \1\b

Howdy,

Perfect! and if I put \1 in the Replace: panel it seems to replace it with a single copy. The system will be Cmd-F and set up Find: and Replace: and the Return to find the first duplicate. From then on Replace & Find (Opt-Cmd-G) to replace and find next or Find Next (Cmd-G) to go to the next find without replacing.

Good Luck,

Herb Schulz
(herbs at wideopenwest dot com)






More information about the macostex-archives mailing list