procmail
[Top] [All Lists]

Re: Having problems using $match

2001-09-03 00:24:29
On Sun, Sep 02, 2001 at 11:09:56AM +0700, Tim Rice wrote:
In your message regarding Re: No match on Invalid recipient: dated Sat, 1
Sep 2001 23:59:23 +0700, Tim Rice said that ...

Hello All,

Two questions if I may, 
First my problems are always caused from my lack of understanding regular
expressions, good books are hard to find in my part of Thailand so I'll
need to order one from Amazon. Any recommendations on regex books for
beginners? Something like the procmailex pages but for regx? I need
something with lots of examples.  

Here's a good book on regex -- not necessarily for beginners though.
But I'd give it a try anyway.  It has plenty of examples.

  - http://www.oreilly.com/catalog/regex/ -  


Second, I'm trying to grab an email address from the body and add it to a
file.
I think it should be something like this, but I cant get the Match usage
correct.

:0:
* ^From: Subject: *failure notice
* B ?? To: \/[        ]*
$MATCH >> $HOME/somefile

The "To: \/" I'm trying to grab and add is in the body, not the header.
Verbose does "Match" something on line two, but line 3 tends to make new
directories and call comsat.

I think this is what you want to do:

:0
* ^Subject: *failure notice
* B ?? To: \/[-_(_dot_)+a-z0-9]+(_at_)[-_(_dot_)+a-z0-9]+
| echo $MATCH >> $HOME/somefile

This recipe will append an email address to 'somefile'.  It will also
trash the original email message.

-- 
- Matt Dunford <> zoot(_at_)zotikos(_dot_)com ..
-. www.zotikos.com -- o,;-
        
My son, reject not the correction
of the Lord: and do not faint when thou
art chastised by him.
   -- Proverbs 3:10
--
_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

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