diff options
author | Éric Araujo <merwok@netwok.org> | 2011-09-02 17:32:30 +0200 |
---|---|---|
committer | Éric Araujo <merwok@netwok.org> | 2011-09-02 17:32:30 +0200 |
commit | 012b6d0d240ce5dc0300053f1d54b07a1a475680 (patch) | |
tree | 7d0e26aa6a8d94cbe74690ddde0d88ee5bd3261d /Lib/re.py | |
parent | 06d31b8de71adb50315199ff467fe91990b5b459 (diff) | |
parent | d2b5ed0abcd113daaecd587edb3c3f95d8942c89 (diff) | |
download | cpython-012b6d0d240ce5dc0300053f1d54b07a1a475680.tar.gz |
Merge 3.2
Diffstat (limited to 'Lib/re.py')
-rw-r--r-- | Lib/re.py | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -215,12 +215,14 @@ def template(pattern, flags=0): return _compile(pattern, flags|T) _alphanum_str = frozenset( - "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890") + "_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890") _alphanum_bytes = frozenset( - b"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890") + b"_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890") def escape(pattern): - "Escape all non-alphanumeric characters in pattern." + """ + Escape all the characters in pattern except ASCII letters, numbers and '_'. + """ if isinstance(pattern, str): alphanum = _alphanum_str s = list(pattern) |