Mac OS X search and replace tool with regular expression support
Solution 1:
Oh, I also just found this:
http://www.dprog.ch/home/products/find_and_replace_it/
About Find & Replace It!
A powerful search and replace utility. It allows performing very complex batch replacements inside text files of any size. It supports regular expression syntax and dozens of encodings. It has scripting capabilities which allow transforming on the fly the replacement text for every found string. It even handles batch processing of the encoding of files, as well as of types of end-of-lines.
Here are some key features of Find & Replace It!:
- Find and replace across many files at once
- Supports regexps
- Supports many text encodings
- Provides a regexp editor
- Provides a find & replace preview
- Offers a scripting interface that allows to transform replacement text on the fly
- Many more features
It's developed by dProg - Philippe Docourt. I've never used it, so take this reccomendation with a grain of salt!
Solution 2:
You're probably looking for a GUI app, but I can reccomend a terminal command. Perl can do inline replacement:
find . -type f -exec perl -p -i -e "s/SEARCH_REGEX/REPLACEMENT/g" {} \;
This will find all files under the current directory and replace based on the provided regexp. If you need to change directories, an easy way is to type: cd (be sure there's a space after) and then drag and drop a folder from the Finder onto the terminal window. Press return and you'll be in the folder you want; then run the perl command above.
If you want perl to make backup copies before replacing, run:
find . -type f -exec perl -p -i.bak -e "s/SEARCH_REGEX/REPLACEMENT/g" {} \;