summaryrefslogtreecommitdiff
path: root/Lib/re.py
diff options
context:
space:
mode:
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
commit012b6d0d240ce5dc0300053f1d54b07a1a475680 (patch)
tree7d0e26aa6a8d94cbe74690ddde0d88ee5bd3261d /Lib/re.py
parent06d31b8de71adb50315199ff467fe91990b5b459 (diff)
parentd2b5ed0abcd113daaecd587edb3c3f95d8942c89 (diff)
downloadcpython-012b6d0d240ce5dc0300053f1d54b07a1a475680.tar.gz
Merge 3.2
Diffstat (limited to 'Lib/re.py')
-rw-r--r--Lib/re.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/Lib/re.py b/Lib/re.py
index abd7ea27b3..cdf597627f 100644
--- a/Lib/re.py
+++ b/Lib/re.py
@@ -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)