procmail
[Top] [All Lists]

Re: quick question

1999-06-11 06:30:06
On Thu, 10 Jun 1999, Michael Johnson wrote:

Era says: 
In this particular case, you should probably write
    * ^From:(.*\<)?foo(_at_)fizz\(_dot_)terra\(_dot_)net\>

Now here at the end-- does the \> do something special besides matching an
literal > at the end of the mail-- that is will it still match the
terra\.net even if there is no > at the end ( that is will \.terra\.net\>
match still match terra.net as _well_ as terra.net>?) 

\> is twice special; normally it'd mean "match just a >", but procmail
sees it as being special (check the procmailrc manpage, near the bottom).

and ( all these characters just make me zone at times ):  with the:
(.*\<)? doesn't the ? match 0 or 1 occurences of anything in the ()?
if so how does that work with the (.*) characters since .* means 0 or
more occurences of any character? Don't the .* and the ? contradict
each other since the ? applies to anything in the ()?

I'll let Era explain what he's doing with the "(.*\<)?" part. What he's
trying to do, in general, is match as specifically as possible. If you
know that this "From" address never changes, you can write something like:
* ^From: name <foo(_at_)fizz\(_dot_)terra\(_dot_)net>$

but people sometimes change what 'name' is, or add comments after the
<address> part, so some generality is good:
* ^From:(_dot_)*foo(_at_)fizz\(_dot_)terra\(_dot_)net


I need to go back and re-study everything ( including regexes ) .

Be sure and check the procmailrc manpage for the procmail extensions :)

Sometimes I wish there was an 'error-checking' feature like Perl has
with 'use strict' and -w so I could keep myself out of the
doghouse.:-) Thanks everyone for your time and I appreciate your
patience. :-)

A couple people have tried something like this; I know J. Aalto has
something; I also started a program that would work something like 'cdecl'
where you could feed it a recipe and it would come back with:
'Match on "From" (_dot_)*foo(_at_)fizz\(_dot_)terra\(_dot_)net and with a 
subject of "testing"
and save it to the folder "testing"'. I'm not brave enough to parse down
the regular expressions, but I would like to add in the '-w' type stuff,
where it will warn you of shady syntax.

-jeff
-- 
...at the chess-board we cannot go beyond it nor do we want to.  We
have got our chessmen and we know their every value, and movement and
power, so it is up to us to make the moves which we hope will give us
victory. ... yet all the time, just as in life, we have to face problems.

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