C
candide
Excerpt from the Regular Expression HOWTO
(http://docs.python.org/howto/regex.html#non-capturing-and-named-groups) :
(http://docs.python.org/howto/regex.html#non-capturing-and-named-groups) :
Perl implementations are divergent on this point. Any opinion ?
The Python documentation oversimplifies.
Le 03/01/2012 12:56, Devin Jeanpierre a écrit :The Python documentation oversimplifies.
You meant Perl Documentation, didn't you ?
It's a commun opinion that non-capturing groups have a price (minor), for
instance Jan Goyvaerts, a well known regular expression guru, refering to
Python code, tells :
non-capturing groups (...) Â offer (slightly) better performance as the regex
engine doesn't have to keep track of the text matched by non-capturing
groups.
[link is there :
http://stackoverflow.com/questions/...xpressions-non-capturing-group-is-not-working]
It seems Javascript performs better respect to non-capturing groups :
http://jsperf.com/regex-capture-vs-non-capture
The same for java : http://eyalsch.wordpress.com/2009/05/21/regex/
(no benchmarks).
For my part, Python tests didn't show any kind of significative penality.
I guess that works too. I did mean Python, though -- its intent is to
say "you shouldn't worry about this", but in the process it says "this
does not exist" (a lie).
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.