You Cannot Parse HTML with Regular Expressions
stackoverflow.com
stackoverflow.com
("No one should ever use regular expressions" is hyperbolic and wrong.)
What "REs can't parse HTML" means in theory is that you cannot design a regexp that tells HTML apart from non-HTML.
The fundamental reason is that regexps cannot detect arbitrarily-deep nested structures.
In practice it is possible, because most regexp engines are Turing complete, but it would be crazy to do so.