in reply to Better way?

Not much more to say. Try to generalize the parser as much as possible (by matching as little as possible). I think chromatic's suggestion of using an HTML parser, rather than dealing with the raw HTML directly, might make your code easier to change later. Also, set up some kind of monitoring so the code tells you when parsing breaks.

Good luck! Sorry we couldn't offer you more help.