4 ms·
Alternative title: the true danger of conflating regular expressions and backtracking pattern matchers. I wonder if it would be possible to reintroduce that dis
by plesner 11y ago
Alternative title: the true danger of conflating regular expressions and backtracking pattern matchers. I wonder if it would be possible to reintroduce that distinction.
- igravious 11y agobacktracking, i.e. utilizes a stack, i.e. more powerful than a regular (language) pattern matcher. Alternative title: you can use regex derivatives (PCRE, Ruby ::Regexp, Boost.Regex, ...) to match non-regular syntax but you shouldn't. The advice still holds. In the case of HTML you should reach for an XML parser.
- Veedrac 11y agoI think the warning should be parsing complex domains with regex libraries, not a restriction to regular syntaxes. There are simple cases where backtracking (or some other extension) plus regex makes sense. Something like (\w+) \d+ \1 is simpler as a regex than any other common tool available.
- nmrm2 11y ago> Alternative title: you can use regex derivatives... This is particularly confusing because you mean "derivative" in the sense of "etymologically/conceptually related", but there is actually a (formal) notion of the derivative of a regular expression.