procmail
[Top] [All Lists]

Re: pattern match problem

1997-09-23 14:54:23
On Tue, 23 Sep 1997 12:47:31 -0700 (PDT),
Joel Bremson <staffjb(_at_)hooked(_dot_)net> wrote:
I'd like to pattern match the following:
     Name:_________________
in all the reaonable ways it can show up. What is wrong with my pattern
match?
        * ([nN]ame|NAME):?[     ]?*_*

(1) ?* is illegal syntax, use one or the other (I suppose *)

(2) You should probably have _+ instead of _* if that's what you mean
(I'm guessing you do)

(3) Procmail is case-insensitive unless you also have a :D flag on the
recipe for some reason, so you can simply say "name" and it will also
match Name, NAME, and nAmE etc.

If you want this to be alone on a line, you could also anchor it, at
least at the beginning (so as not to match e.g. a quoted passage where
someone writes "You have to fill in the name field, too", which your
proposed expression would match unless you restrict it a bit more --
that's one reason to use + instead of *):

  * ^[   ]*Name:?[      ]*_+

Hope this helps,

/* era */

-- 
 Paparazzi of the Net: No matter what you do to protect your privacy,
  they'll hunt you down and spam you. <http://www.iki.fi/~era/spam/>

<Prev in Thread] Current Thread [Next in Thread>