diff options
author | Guido van Rossum <guido@python.org> | 1997-10-22 21:00:49 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1997-10-22 21:00:49 (GMT) |
commit | 9694fcab5332f27dc28b195ba1391e5491d2eaef (patch) | |
tree | 23dc3d9a7d1cc4b138ac2bffd028a519cba93b30 /Lib/posixpath.py | |
parent | 426916e50e1209d8ecc12678855dc531863a48c5 (diff) | |
download | cpython-9694fcab5332f27dc28b195ba1391e5491d2eaef.zip cpython-9694fcab5332f27dc28b195ba1391e5491d2eaef.tar.gz cpython-9694fcab5332f27dc28b195ba1391e5491d2eaef.tar.bz2 |
Convert all remaining *simple* cases of regex usage to re usage.
Diffstat (limited to 'Lib/posixpath.py')
-rw-r--r-- | Lib/posixpath.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/Lib/posixpath.py b/Lib/posixpath.py index 965184b..9960801 100644 --- a/Lib/posixpath.py +++ b/Lib/posixpath.py @@ -266,15 +266,15 @@ def expandvars(path): if '$' not in path: return path if not _varprog: - import regex - _varprog = regex.compile('$\([a-zA-Z0-9_]+\|{[^}]*}\)') + import re + _varprog = re.compile(r'\$(\w+|\{[^}]*\})') i = 0 while 1: - i = _varprog.search(path, i) - if i < 0: + m = _varprog.search(path, i) + if not m: break - name = _varprog.group(1) - j = i + len(_varprog.group(0)) + i, j = m.span(0) + name = m.group(1) if name[:1] == '{' and name[-1:] == '}': name = name[1:-1] if os.environ.has_key(name): |