Message273178
| Author |
martin.panter |
| Recipients |
ezio.melotti, martin.panter, mrabarnett, r.david.murray, terry.reedy |
| Date |
2016年08月20日.01:18:28 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1471655908.57.0.577348618635.issue27800@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
Okay so it sounds like my usage is valid if I add the brackets. I will try to come up with a documentation patch as some stage. The reason why it is not supported without brackets is to maintain a bit of consistency with the question mark (?), which modifies the preceding quantifier, and with the plus sign (+), which is also a modifier in other implementations.
For the record, Gnu grep does seem to accept my expression (although Posix says this is undefined, and neither support lazy or possessive quantifiers):
$ grep -E -o 'a{2}*' <<< "aaaaa"
aaaa
However pcregrep, which supports lazy (?) and possessive (+) quantifiers, doesn’t like my expression:
$ pcregrep -o 'a{2}*' <<< "aaaaa"
pcregrep: Error in command-line regex at offset 4: nothing to repeat
[Exit 2]
$ pcregrep -o '(?:a{2})*' <<< "aaaaa"
aaaa |
|