Tim Peters added the comment:

I would not call this a bug - it's just usually a silly thing to do ;-)

Note, e.g., that p{N} is shorthand for writing p N times.  For example, p{4} is 
much the same as pppp (but not exactly so in all cases; e.g., if `p` happens to 
contain a capturing group, the numbering of all capturing groups will differ 
between those two spellings).

A successful assertion generally matches an empty string (does not advance the 
position being looked at in the target string).  So, e.g., if we're at some 
point in the target string where

(?<=a)

matches, then

(?<=a)(?<=a)

will also match at the same point, and so will

(?<=a)(?<=a)(?<=a)

and

(?<=a)(?<=a)(?<=a)(?<=a)

and so on & so on.  The position in the target string never changes, so each 
redundant assertion succeeds too.  So (?<=a){N} _should_ match there too.

> It works like there are 10 letters "a" before letter "b".

It's much more like you're asking whether "a" appears before "b", but are 
rather pointlessly asking the same question 10 times ;-)

----------
nosy: +tim.peters

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

Reply via email to