My regex is being run in both Python v2.6 and v3.1 For this example, I'll give one line. This lines will be read out of log files. I'm trying to get the GUID for the User ID to query a database with it, so I'd like a sub match. Here is the code ----------------- import re line = '>Checking Privilege for UserId: {88F96ED2-D471-DE11-95B6-0050569E7C88}, PrivilegeId: {71AD2527-8494-4654-968D-FE61E9A6A9DF}. Returned hr = 0' pUserID=re.compile('UserID: \{(.+)\}',re.I) #Sub match is one or more characters between the first set of squigglies immediately following 'UserID: '
#the output is: (re.search(pUserID,line)).group(1) '88F96ED2-D471-DE11-95B6-0050569E7C88}, PrivilegeId: {71AD2527-8494-4654-968D-FE61E9A6A9DF' ----------- Why isn't the match terminating after it finds the first \} ? -- View this message in context: http://www.nabble.com/Issues-with-regex-escaping-on-%5C%7B-tp24724060p24724060.html Sent from the Python - tutor mailing list archive at Nabble.com. _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor