The Opposite of re match

Skip Montanaro skip at
Thu Aug 22 18:19:37 CEST 2002

    Ben> You could perhaps run some basic checks that help to narrow it
    Ben> down, for example to see if just the extension matches or the
    Ben> length matches, or match certain parts in isolation.

    Matt> Yes, that is the general idea I am persuing, but unfortunately the
    Matt> example I presented here is a lot simpler than the real problem!

One thing I've done where I have a complex but static regular expression is
to actually create multiple re's, each one shorter than the actual re.
Symbolically, if the re consists of four logical chunks, ABCD, if the match
failed, I would try matching ABC, AB, and A in succession, to try and narrow
down for users where their data entry failed.  Generally, the separation
between chunks is some sort of natural punctuation for the strings being
matched (in my case, concert venue listings).

Skip Montanaro
skip at

More information about the Python-list mailing list