Martin Panter added the comment:

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

----------

_______________________________________
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