4 ms·
> HTML is impossible. This comes up a lot. Most languages' "regular expressions" aren't, in fact, regular. A true regular expression wouldn't be able to matc
by thedufer 13y ago
> HTML is impossible.
This comes up a lot. Most languages' "regular expressions" aren't, in fact, regular. A true regular expression wouldn't be able to match HTML, but Perl regular expressions (the de facto standard) can because of backreferences.
Edit: I'm not saying this is a good idea; it most certainly isn't. I'm just saying its possible.
- ygra 13y agoPerl's regex support can match HTML because of recursive matching, not only because of backreferences (the latter of which is widely implemented, the former not quite so). That being said, there surely are some fun languages that can be matched by what's commonly called regular expressions. Notepad++ was notable (before switching to PCRE) that its "regular expressions" could not even match every regular (or even finite) language (http://stackoverflow.com/a/4815422/73070 http://stackoverflow.com/a/4815422/73070). Many regex engines allow matching languages that are context-sensitive, while at the same time not accepting all context-free languages.