2 ms·
backtracking, i.e. utilizes a stack, i.e. more powerful than a regular (language) pattern matcher. Alternative title: you can use regex derivatives (PCRE, Ruby
by igravious 11y ago
backtracking, 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.