Efficient String Lookup?

Chris S. chrisks at NOSPAM.udel.edu
Sun Oct 17 02:33:57 EDT 2004


Andrew Dalke wrote:
> Here's the output I got when I ran it
> 
> 
> abadb?  We've got a 'Antimatter containment field breach' warning!
> abcdef?  We've got a 'Reactor meltdown imminent' warning!
> zxc?  That's okay.
> abcq?  We've got a 'Antimatter containment field breach' warning!
> b1234f?  We've got a 'Coffee too strong' warning!

Actually, I've noticed some strange behavior. It seems to match more 
than one character per wild card. For instance, your code matches 
'abaxile', 'abaze', and 'abbacomes' to the pattern 'ab##'. I'm not an 
expert with rex, but your expression looks correct. What could be 
causing this?



More information about the Python-list mailing list