#test.py
import re

# compiles under CPython, fails under IronPython
myregex = re.compile (r"[\\A-Z\.\+]")

if myregex.search ('aaaA\\B\\Caaa'):
        print 'found'
else:
        print 'not found'

-------------------------


I tried to run my Python script under Iron Python and this line:

        re.compile (r"[\\A-Z\.\+]")

does not compile.  I get

        re.error: parsing "[\A-Z\.\+]" - Unrecognized escape sequence
\A.

To fix it, I had to go to 3 slashes, not 2 or 4:

        re.compile (r"[\\\A-Z\.\+]")

This seems a bit counter-intuitive to me.  

Thanks
chuck




_______________________________________________
users mailing list
users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

Reply via email to