Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Alternative title: the true danger of conflating regular expressions and backtracking pattern matchers. I wonder if it would be possible to reintroduce that distinction.


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.


I 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.


> 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.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: