diff options
author | Éric Araujo <merwok@netwok.org> | 2011-09-03 00:48:17 +0200 |
---|---|---|
committer | Éric Araujo <merwok@netwok.org> | 2011-09-03 00:48:17 +0200 |
commit | 4778b90a1f0e8f8ca31a733177a7a210fed8b501 (patch) | |
tree | 76f9265f99d66c31534f753ac2151fc3464fd3f5 /Lib/re.py | |
parent | c256a757f82ef3963d137244373be69c97660fac (diff) | |
parent | 012b6d0d240ce5dc0300053f1d54b07a1a475680 (diff) | |
download | cpython-4778b90a1f0e8f8ca31a733177a7a210fed8b501.tar.gz |
Merge fix for #8286 from 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) |