Bug in RE's?

Robin Siebler robin.siebler at corp.palm.com
Fri Oct 18 14:14:11 EDT 2002


Robin Munn <rmunn at pobox.com> wrote in message 

>What's the RE you're searching against? 
I have about 30 words that I am searching for.  Here is the code I am
using to generate the RE:

pattern = '\w+word\w+|\w+word|word\w+|word'
temp_pattern = ''
for word in ExcludeWords: 
    temp_pattern = pattern.replace('word', word.lower()) + '|' +
temp_pattern
s_word = re.compile(temp_pattern[0:-1], re.IGNORECASE)  #Strip the
last '|'

The length of temp_pattern is 1024

>When you say the RE "stops working in the same place and starts
working again >in the same place" do you mean the same place in the RE
or the same place in
> the file you're searching?

The RE always stops working on the exact same line in the exact same
file.  When it starts working again, it starts working on the exact
same line in the exact same file.  Sometimes it stops and starts
working within the same file and sometimes it stops working in one
file and doesn't start working until the next file, however, this is
always consistent as well.
 
> If the RE and/or the example file(s) are short, post them here and we
> can try to figure out what's going on. If they're long, you might put
> them up somewhere and post a URL. It would also help if you would quote
> the relevant line(s) from the file(s) where the RE starts and/or stops
> working.
 
I ran the good version of my script against a bunch of .py files and I
ran the bad version against the same files.  I copied the logs
generated by the scripts, the scripts, and all of the files the
scripts need to
https://secure.americasnet.com/321.net/files/robinsiebler/public/. 
You will need to install Optik (http://optik.sourceforge.net/) to run
my scripts.



More information about the Python-list mailing list