This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author tim.peters
Recipients BreamoreBoy, ezio.melotti, mrabarnett, py.user, serhiy.storchaka, tim.peters
Date 2014-06-26.19:24:16
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1403810657.4.0.173734878095.issue14460@psf.upfronthosting.co.za>
In-reply-to
Content
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 ;-)
History
Date User Action Args
2014-06-26 19:24:17tim.peterssetrecipients: + tim.peters, ezio.melotti, mrabarnett, py.user, BreamoreBoy, serhiy.storchaka
2014-06-26 19:24:17tim.peterssetmessageid: <1403810657.4.0.173734878095.issue14460@psf.upfronthosting.co.za>
2014-06-26 19:24:17tim.peterslinkissue14460 messages
2014-06-26 19:24:16tim.peterscreate