When Good Regular Expressions Go Bad

Skip Montanaro skip at mojam.com
Thu Sep 30 10:42:03 EDT 1999


    Tim> [Douglas Alan]
    >> It seems to me that even when a regular expression fails to match a
    >> string, you might want to know just how far it was able to get before
    >> getting stuck. 

    Tim> I believe this would be easy to add to any regexp engine I've ever
    Tim> seen, and also believe I've never seen one that keeps track of it.
    Tim> I confess I'm at a loss to think of a compelling use for it,
    Tim> though.

Take a look at

    http://www.musi-cal.com/fast-itineraries.shtml

I want to let people set up schedule submissions and give them some help
when they format their schedules incorrectly.  Currently I use three regular 
rexpressions per selected format, the one that will match a correctly
formatted line and two shorter ones.  When the real thing fails I use the
shorter ones to try and give the user some idea of where they might have
gone astray.  Of course, users aren't told that regular expressions underly
the pattern matcher.

compellingness-is-in-the-eyes-of-the-programmer-ly y'rs,

Skip Montanaro | http://www.mojam.com/
skip at mojam.com | http://www.musi-cal.com/
847-971-7098   | Python: Programming the way Guido indented...




More information about the Python-list mailing list