http://www.perlmonks.org?node_id=34292


in reply to Big, bad, ugly regex problem

A couple of comments. Use a HTML Parser if at all possible. Your brane will thank you in the long run. I think someone has already suggested that. Apart from that though so far I can only see one thing wrong with the regex. You specify an optional open quote with \3 and an optional close quote matching \3 but in between you use \3 with a negative lookahead and for the times when there isn't a \3 bad stuff will happen. I'm not sure really what will happen. IIRC these catch variables are guaranteed to be undefined when you start a new match or substitution.