Yet another RE question

Bogdan Marinescu bogdanal at b.astral.ro
Sat Jan 10 03:36:07 EST 2004


    Hello all,

    First I want to apologize if this was already discussed before, I can't find an answer anywhere right now. I'm writing a simple compiler for a small language using Spark (http://pages.cpsc.ucalgary.ca/~aycock/spark/). And I just found out that the regular expressions in Python follow the Perl semantics (first-then-longest) instead of the POSIX semantics (longest match). This is quite annoying for me; while some solutions to this problem exists and they are shown in the Spark documentation, I have some background with lex/yacc and I would really like to use the "lex" semantics (longest match). Is there a package for Python that implements this behaviour?
    Thank you,

    Bogdan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20040110/fcf0e890/attachment.html>


More information about the Python-list mailing list