TextWrangler is an excellent and free text editing application for OS X. Common text editing "sanitation" issues include removing blank lines and HTML tags from a text document. Two simple methods to sanitize text are described below.

Removing Blank Lines:

To remove blank lines from a text file in TextWrangler, you have to run Search and Replace, tick the ‘Use Grep’ option and then search on the pattern ^\r. Replace with nothing and the effect is like magic.

Removing all HTML Tags from a File:

The pattern < /?[^>]> can be used to remove all the HTML tags from a file. I’d advise replacing the tags with a single space.


The above tips are from Keith Burnett and his very useful web site.