Descriptionregexp: implement backtracking with pcre fallback
Go's current regular expression package doesn't support all
popular patterns which programmers from other languages have
come to expect. Notably, the Go regexp package doesn’t
implement the useful backreference functionality. Without
that, users can't match "catcat" or "dogdog" with (cat|dog)\1
and would need to otherwise fall back to writing multiple
lines of code, possibly involving an "if" statement.
To permit more expressiveness than Go's strictly "regular"
regular expressions, this change permits falling back to the
wildly popular PCRE library when Go would previously return a
compile error.
This permits programmers to copy-paste common regular
expressions from forum sites, stackoverflow, etc. and rest
assured that they'll work as they would have in PHP or Ruby.
Go shouldn't let ideological fundamentalism about algorithmic
purity limit user adoption.
Thanks to Florian Wiemer for his work on the pcre package
which is now promoted to the core library.
This CL doesn't yet implement Perl's (?{ code }) construct. A
future CL will bring Campher into the core, permitting calling
into Perl from Go regular expressions.
Fixes issue 3451
Patch Set 1 #Patch Set 2 : diff -r 15a98eba66e0 https://go.googlecode.com/hg/ #
Total comments: 2
Patch Set 3 : diff -r 15a98eba66e0 https://go.googlecode.com/hg/ #
Total comments: 7
MessagesTotal messages: 12
|