View Single Post
Old 05-23-2006, 10:19 PM   #4 (permalink)
teknomage1
Jack of all trades
 
teknomage1's Avatar
 
Join Date: Feb 2005
Location: Los Angeles
Posts: 598
teknomage1 is on a distinguished road
Send a message via AIM to teknomage1
If you want to start checking for properly balanced tags you have to build more sophisticated machinery than just regular expressions. Arbitrarily nestable expressions like (1 + (2 * (6 - 3)) and html tag trees, are not regular languages and cannot be accurately described by regular expressions.

It seems like you can get away with only replacing < or > than signs that are not next to text on your first run through. eg. 's/<([^A-Za-z])/&lt\1/g' and 's/([^A-Za-z])>/\1&gt/g' .
__________________
Stop intellectual property from infringing on me
teknomage1 is offline   Reply With Quote