[IronPython] Valid regex under CPython won't compile under IronPython
Eric.Wyler at bentley.com
Eric.Wyler at bentley.com
Thu Jun 14 09:09:41 PDT 2007
#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-Septembe
r/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/20070614/38d25ca3/attachment.html
More information about the users
mailing list