String search vs regexp search

Alex Martelli aleax at aleax.it
Tue Oct 14 12:36:37 EDT 2003


Jeremy Fincher wrote:

> Duncan Booth <duncan at NOSPAMrcp.co.uk> wrote in message
> news:<Xns941462CDB5003duncanrcpcouk at 127.0.0.1>...
>> Ok, found the code. Regular expression searches do indeed use a form of
>> Boyer-Moore, but not if you are ignoring case. So by specifying
>> re.IGNORECASE the OP got a double hit, not only does the code have to do
>> case insensitive comparisons, but it also has to crawl along looking at
>> every character in the search string instead of skipping most of them.
> 
> That's cool!  Where'd you find the code?

Hmmm, dist/src/Modules/_sre.c in the Python CVS tree?  Or Modules/_sre.c in
a standard source distribution?


Alex





More information about the Python-list mailing list