I'm a little late here, but I'd just like to add that when I find myself thinking about using regexen to process web content that I really want to be using a template system of some kind. That may not be the case for you, but almost always is for me. See
HTML::Template or
many others for some good starting points. Also try searching on 'template toolkit' here in the monastery for some good discussion on this too.
"A man's maturity -- consists in having found again the
seriousness one had as a child, at play." --Nietzsche