New submission from py.user <port...@yandex.ru>:

http://docs.python.org/py3k/library/re.html
"Note that patterns which start with positive lookbehind assertions will never 
match at the beginning of the string being searched; you will most likely want 
to use the search() function rather than the match() function:"

>>> re.match(r'(?<=^)abc', 'abc').group()
'abc'
>>> re.match(r'(?<=\b)abc', 'abc').group()
'abc'
>>> re.match(r'(?<=\A)abc', 'abc').group()
'abc'
>>> re.match(r'(?<=\A)abc', 'abc', re.DEBUG).group()
assert -1 
  at at_beginning_string 
literal 97 
literal 98 
literal 99 
'abc'
>>>


in some cases match() can match

----------
assignee: docs@python
components: Documentation, Regular Expressions
messages: 157265
nosy: docs@python, ezio.melotti, mrabarnett, py.user
priority: normal
severity: normal
status: open
title: In re's positive lookbehind assertion documentation match() cannot match
versions: Python 3.2

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

Reply via email to