Yet another RE question

Bogdan Marinescu bogdanal at
Sat Jan 10 09:36:07 CET 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 ( 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,

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Python-list mailing list