How to use regular expressions to parse HTML in Java?

Using regular expressions to pull values from HTML is always a mistake. HTML syntax is a lot more complex that it may first appear and it’s very easy for a page to catch out even a very complex regular expression.

Use an HTML Parser instead. See also What are the pros and cons of the leading Java HTML parsers?

Leave a Comment