in reply to Yet another regex question

Sounds like you need a proper parser. This is similar to why you need more than just regexen to parse (arbitrary) HTML reliably.

And just a thought, you might find it easier to implement in with grep rather than a regex.

--
We're looking for people in ATL