Matthew Barnett added the comment:

"*" and the other quantifiers ("+", "?" and "{...}") operate on the preceding 
_item_, not the entire preceding expression. For example, "ab*" means "a" 
followed by zero or more repeats of "b".

You're not allowed to use multiple quantifiers together. The proper way is to 
use the non-capturing "(?:...)".

It's too late to change that because some of them already have a special 
meaning when used after another quantifier: "a*?" is a lazy quantifier, as are 
"a+?", "a??" and "a{1,4}?".

Many other regex implementations, including the "regex" module, use an 
additional "+" to signify a possessive quantifier: "a*+", "a++", "a?+" and 
"a{1,4}+".

That just leaves the additional "*", which is treated as an error in all the 
other regex implementations that I'm aware of.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue27800>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to