As I have answered in HTML-and-regex questions here so many times before, the use of regex will not allow you to consume HTML.
Regex is not a tool that can be used to correctly parse HTML.
HTML-plus-regexp will liquify the nerves of the sentient whilst you observe, your psyche withering in the onslaught of horror.
Rege̿̔̉x-based HTML parsers are the cancer that is killing Stack Overflow it is too late it is too late we cannot be saved the trangession of a chi͡ld ensures regex will consume all living tissue (except for HTML which it cannot, as previously prophesied) dear lord help us how can anyone survive this scourge using regex to parse HTML has doomed humanity to an eternity of dread torture and security holes using regex as a tool to process HTML establishes a breach between this world and the dread realm of c͒ͪo͛ͫrrupt entities (like SGML entities, but more corrupt) a mere glimpse of the world of regex parsers for HTML will instantly transport a programmer's consciousness into a world of ceaseless screaming, he comesithy regex-infection will devour your HTML parser, application and existence for all time like Visual Basic only worse he comes he comes do not fight he com̡e̶s, ̕h̵is un̨ho͞ly radiańcé destro҉ying all enli̍̈́̂̈́ghtenment, HTML tags lea͠ki̧n͘g fr̶ǫm ̡yo͟ur eye͢s̸ ̛l̕ik͏e liquid pain, the song of re̸gular expre Moderator's Note This post is locked to prevent inappropriate edits to its content. If you have a small set of HTML pages that you want to scrape data from and then stuff into a database, regexes might work fine.
And if you are comfortable with coding regexes, way faster to code than coding xpaths. Using an HTML minifier to remove all whitespace in your document that the browser doesn't render?
Regular expressions are a tool that is insufficiently sophisticated to understand the constructs employed by HTML.
Regex queries are not equipped to break down HTML into its meaningful parts. Even enhanced irregular regular expressions as used by Perl are not up to the task of parsing HTML. HTML is a language of sufficient complexity that it cannot be parsed by regular expressions.Even Jon Skeet cannot parse HTML using regular expressions.