[IronPython] Valid regex under CPython won't compile under IronPython

Martin Maly Martin.Maly at microsoft.com
Fri Jun 15 08:58:44 PDT 2007


Thanks for the bug report, Eric, I've filed another bug on CodePlex to track this more complicated issue.

http://www.codeplex.com/IronPython/WorkItem/View.aspx?WorkItemId=11136

Martin

From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Eric.Wyler at bentley.com
Sent: Thursday, June 14, 2007 9:10 AM
To: users at lists.ironpython.com
Subject: [IronPython] Valid regex under CPython won't compile under IronPython

#test.py
import re

# The below line fails under IronPython 1.1 (but works under Cpython)
regex = re.compile( r"^(?P<msg>NMAKE[A-Za-z0-9]*)'\"?(?P<file>[\\A-Za-z0-9/:_\.\+]+)" )

if regex.search( r"NMAKE0119'adirectory\afile.txt" ):
    print 'good'
else:
    print 'bad'

----------------------------------------------------------------------
The following error is emitted:
re.error: parsing "^(?<msg>NMAKE[A-Za-z0-9 \t:]*)'\"?(?<file>[\A-Za-z0-9/:_\.\+]+)" - Unrecognized escape sequence \A.

There was a previous bug report about this at http://lists.ironpython.com/pipermail/users-ironpython.com/2006-September/003382.html which was fixed, but it doesn't seem to work in this more complicated case.

If the double slashes are moved to the end of the character class, it works.  Interestingly, it also works if you remove the \"?.

Thanks,
Eric
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ironpython.com/pipermail/users-ironpython.com/attachments/20070615/9d726679/attachment.html 


More information about the users mailing list