Efficient String Lookup?
Andrew Dalke
adalke at mindspring.com
Sun Oct 17 05:26:27 EDT 2004
More information about the Python-list mailing list
Sun Oct 17 05:26:27 EDT 2004
- Previous message (by thread): Efficient String Lookup?
- Next message (by thread): Efficient String Lookup?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Chris S. wrote: > 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? It's matching the prefix. To make it match the string and only the string you need a $. Either do (pat1$)|(pat2$)| ... |(patN$) or do ((pat1)|(pat2)| ... |(patN))$ If you do the last, don't forget to omit group(1) in the list of results, or use the non-capturing group notation, which I believe is (?: ... ) as in (?:(pat1)|(pat2)| ... |(patN))$ Andrew dalke at dalkescientific.com
- Previous message (by thread): Efficient String Lookup?
- Next message (by thread): Efficient String Lookup?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list