summaryrefslogtreecommitdiffstats
path: root/Lib/posixpath.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1997-10-22 21:00:49 (GMT)
committerGuido van Rossum <guido@python.org>1997-10-22 21:00:49 (GMT)
commit9694fcab5332f27dc28b195ba1391e5491d2eaef (patch)
tree23dc3d9a7d1cc4b138ac2bffd028a519cba93b30 /Lib/posixpath.py
parent426916e50e1209d8ecc12678855dc531863a48c5 (diff)
downloadcpython-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.py12
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):