Message153188
| Author |
Devin Jeanpierre |
| Recipients |
Devin Jeanpierre, ezio.melotti |
| Date |
2012年02月12日.08:54:42 |
| SpamBayes Score |
1.8285422e-05 |
| Marked as misclassified |
No |
| Message-id |
<1329036883.7.0.662970564139.issue13998@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
compiled regex objects' match method offers an optional "pos" parameter described to be roughly equivalent to slicing except for how it treats the "^" operation. See http://docs.python.org/library/re.html#re.RegexObject.search
However, the behavior of lookbehind assertions also differs:
>>> re.compile("(?<=a)b").match("ab", 1)
<_sre.SRE_Match object at 0x...>
>>> re.compile("(?<=a)b").match("ab"[1:])
>>>
This alone might be a documentation bug, but the behavior is also inconsistent with the behavior of lookahead assertions, which do *not* look past the endpos:
>>> re.compile("a(?=b)").match("ab", 0, 1)
>>> re.compile("a(?=b)").match("ab")
<_sre.SRE_Match object at 0x...>
>>> |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2012年02月12日 08:54:43 | Devin Jeanpierre | set | recipients:
+ Devin Jeanpierre, ezio.melotti |
| 2012年02月12日 08:54:43 | Devin Jeanpierre | set | messageid: <1329036883.7.0.662970564139.issue13998@psf.upfronthosting.co.za> |
| 2012年02月12日 08:54:43 | Devin Jeanpierre | link | issue13998 messages |
| 2012年02月12日 08:54:42 | Devin Jeanpierre | create |
|