procmail
[Top] [All Lists]

Re: extract username from email address

2005-09-26 13:02:01
Hi,

On Mon, 26 Sep 2005, 15:02 GMT-04 Joe wrote:

I'm trying to get the username portion of an email
address.  No match though.  Any tips?

"From: Somebody <username(_at_)somedomain(_dot_)com>"

 my_FROM = 'From: Somebody <username(_at_)somedomain(_dot_)tld>'
 :0
  * my_FROM ?? [ <]\/[^ <@]+[(_at_)]
  * MATCH   ?? ^^\/(_dot_)+[^(_at_)]
  {
     my_USERNAME = $MATCH
  }

This should work unless my_FROM is something like
From: " some(_at_)unusual " <username(_at_)somedomain(_dot_)tld>
If the recipe should be that bullet-proof, the "..." or '...' section
should be removed first.

--rob.



____________________________________________________________
procmail mailing list   Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

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