[Tutor] Why doesn't this regex match???

Sheila King sheila@thinkspot.net
Fri, 08 Feb 2002 23:11:44 -0800


Error correction below:

On Fri, 08 Feb 2002 22:53:08 -0800, Sheila King <sheila@thinkspot.net>
wrote about Re: [Tutor] Why doesn't this regex match???:

> We were doing something like this before. Actually, what we were doing
> was more like:
> 
>         s = subject.lower()
> 		s = ' ' + s + ' '
>         isjunk = 0
>         for phrase in spamphrases:
>             if s.find(phrase) >= 0:
>                 isjunk = 1
>                 break

Actually, what we'd been doing was more like:

        s = subject.lower()
 		s = ' ' + s + ' '
         isjunk = 0
         for phrase in spamphrases:
             if s.find(' ' + phrase + ' ') >= 0:
                 isjunk = 1
                 break

We wanted to match, say, "sex" but not "sextant". (As the joke is going
in our discussion group...SO MANY spams that we receive have the word
"sextant" in the subject line!!! )

-- 
Sheila King
http://www.thinkspot.net/sheila/

"When introducing your puppy to an adult cat,
restrain the puppy, not the cat." -- Gwen Bailey,
_The Perfect Puppy: How to Raise a Well-behaved Dog_