#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

_______________________________________________
users mailing list
[email protected]
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

Reply via email to