3 ms·
Is it right that BeautifulSoup was (is?) implemented in terms of Python regular expressions?
by util 16y ago
Is it right that BeautifulSoup was (is?) implemented in terms of Python regular expressions?
- rbonvall 16y agoRegular 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.