6/25/2007
Grep Replace and Word Processing
I spend so much time in a text editor, its hard to get my head around a word processor sometimes. Text and formatting at the same time?
Moving some content around I found myself with a ton of links formatted in an unordered list. I only needed the plaintext of the name and link separate for the current project. My trusty BBEdit with Grep search and replace support yield the following search and replacement patterns to make quick work of the list.
Search Grep Pattern
Replace Grep Pattern
Turned this
into this
http://www.agentb.com/
I always keep an empty BBedit window for text processing like this. Its easy to paste a chunk of text, process it and then paste it back into your word processor.
Note:
I’m almost good enough at Grep search patterns to make this viable in all situations. It used to take me 5 minutes to debug and expression that would have taken 2 minutes to cut and paste manually. I had this one whipped out in much less time than it would have taken to manually cut and paste a hundred of these.
Popularity: 22%


