Bugs item #1518406, was opened at 2006-07-06 16:26 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1518406&group_id=5470
Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Regular Expressions Group: Python 2.4 Status: Open Resolution: None Priority: 5 Submitted By: ollie oldham (ooldham) Assigned to: Gustavo Niemeyer (niemeyer) Summary: re '\' char interpretation problem Initial Comment: I've run across 2 problems having to do with '\' character problems with the re module. Problem 1 does not match the re when it should have. Problem 2 matches, when it should not have. There is a short snippet of code attached that shows the problems I'm having, and the output as it occurs on my machine. I'm running on Windows 2000 Python versions: 2.4b1 and 2.4.3c1 both act the same way. Problem (1) : why does * work and not + ? import re rex = re.compile(r'[a-z]:\.*', re.IGNORECASE) rey = re.compile(r'[a-z]:\.+', re.IGNORECASE) path1 = r'D:\Logs' print rex.match(path1) # Matches - as it should have. print rey.match(path1) # FAILES to match - should have. Problem 2) : match occurs on nonUncPath when it should not import re uncPath = r'\\someUNC\path' nonUncPath = r'\nonUnc\path' rew = re.compile('\\\\.+', re.IGNORECASE) print rew.match(uncPath) # works as it should. print rew.match(nonUncPath) # matches and it should NOT. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1518406&group_id=5470 _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com