4 ms·
Regular expressions can be (and are) used to tokenize the code, but cannot do the actual parsing. What "REs can't parse HTML" means in theory is that you canno
by rbonvall 17y ago
Regular expressions can be (and are) used to tokenize the code, but cannot do the actual parsing.
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.