Textmate Regular Expression Search and Replace

I use and love the text editor Textmate, which has some powerful functions including the use of regular expressions in search.

One thing that it can help with is quickly editing text files, and for example today I used it for searching lines in a mail system’s “aliases” file. I wanted to remove 50-odd lines with the word owner in them, so I used the Find command with Regular Expression checked.

The search string is:


If you enter that string which means to find the lines with owner in them, check “Regular Expression,” and leave a blank in the Replace box, Textmate will blank out the lines for you. Convenient!


Join the discussion at my Google+ post.

—by Rick Cogley