You can't parse [X]HTML with regex
stackoverflow.com
stackoverflow.com
[1] https://en.wikipedia.org/wiki/Regular_expression#Formal_defi...
[2] PCRE engines support recursive matching etc. but perhaps the most illuminating example is regex in Perl 6 such as this JSON grammar (a Perl 6 grammar is a class containing Perl 6 named regexes): https://github.com/moritz/json/blob/master/lib/JSON/Tiny/Gra...