[issue2636] Regexp 2.7 (modifications to current re 2.2.2)
Alex Willmer
report at bugs.python.org
Sun Feb 21 15:46:42 CET 2010
Alex Willmer <alex at moreati.org.uk> added the comment:
On 17 February 2010 19:35, Matthew Barnett <report at bugs.python.org> wrote:
> The main text at http://pypi.python.org/pypi/regex appears to have lost its backslashes, for example:
>
> Â Â The Unicode escapes uxxxx and Uxxxxxxxx are supported.
>
> instead of:
>
> Â Â The Unicode escapes \uxxxx and \Uxxxxxxxx are supported.
Matthew, As you no doubt realised that text is read straight from the
Features.txt file. PyPI interprets it as RestructuredText, which uses
\ as an escape character in various cases. Do you intentionally write
Features.txt as RestructuredText? If so here is a patch that escapes
the \ characters as appropriate, otherwise I'll work out how to make
PyPI read it as plain text.
Regards, Alex
--
Alex Willmer <alex at moreati.org.uk>
http://moreati.org.uk/blog
----------
Added file: http://bugs.python.org/file16278/Features-backslashes.patch
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue2636>
_______________________________________
-------------- next part --------------
=== modified file 'Features.txt'
--- Features.txt 2010-02-17 12:22:14 +0000
+++ Features.txt 2010-02-21 14:44:13 +0000
@@ -61,7 +61,7 @@
regex.findall and regex.finditer support an 'overlapped' flag which permits overlapped matches
Unicode escapes (#3665)
- The Unicode escapes \uxxxx and \Uxxxxxxxx are supported.
+ The Unicode escapes \\uxxxx and \\Uxxxxxxxx are supported.
Large patterns (#1160)
Patterns can be much larger.
@@ -94,23 +94,23 @@
Named groups can be named with (?<name>...) as well as the current (?P<name>...).
Group references
- Groups can be referenced within a pattern with \g<name>. This also allows there to be more than 99 groups.
+ Groups can be referenced within a pattern with \\g<name>. This also allows there to be more than 99 groups.
Named characters
- \N{name}
+ \\N{name}
Named characters are supported.
Unicode properties
- \p{name}
- \P{name}
- Unicode properties are supported. \p{name} matches a character which has property 'name' and \P{name} matches a character which doesn't have property 'name'.
+ \\p{name}
+ \\P{name}
+ Unicode properties are supported. \\p{name} matches a character which has property 'name' and \\P{name} matches a character which doesn't have property 'name'.
Posix character classes
[[:alpha:]]
Posix character classes are supported.
Search anchor
- \G
+ \\G
A search anchor has been added. It matches at the position where each search started/continued and can be used for contiguous matches or in negative variable-length lookbehinds to limit how far back the lookbehind goes:
>>> regex.findall(r"\w{2}", "abcd ef")
More information about the Python-bugs-list
mailing list