in reply to Parsing HTML tags with regex

This article is a good place to start. It describes how to do what you want, and some of the risks of doing it that way.

Peace,
-McD