[issue2636] Regexp 2.7 (modifications to current re 2.2.2)
Matthew Barnett
report at bugs.python.org
Sun Mar 1 02:42:49 CET 2009
Matthew Barnett <python at mrabarnett.plus.com> added the comment:
issue2636-features-5.diff includes:
Bugfixes
Added \G anchor (from Perl).
\G is the anchor at the start of a search, so re.search(r'\G(\w)') is
the same as re.match(r'(\w)').
re.findall normally performs a series of searches, each starting where
the previous one finished, but if the pattern starts with \G then it's
like a series of matches:
>>> re.findall(r'\w', 'abc def')
['a', 'b', 'c', 'd', 'e', 'f']
>>> re.findall(r'\G\w', 'abc def')
['a', 'b', 'c']
Notice how it failed to match at the space, so no more results.
Added file: http://bugs.python.org/file13216/issue2636-features-5.diff
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue2636>
_______________________________________
More information about the Python-bugs-list
mailing list