Message273147
| Author |
mrabarnett |
| Recipients |
ezio.melotti, martin.panter, mrabarnett, r.david.murray |
| Date |
2016年08月19日.17:34:55 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1471628096.23.0.689693647814.issue27800@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
"*" 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. |
|