procmail
[Top] [All Lists]

Re: extract username from email address

2005-09-26 12:51:52
Joe schreef:

* FROM ?? (?<=<)[^(_at_)]*

You are using regex syntax that procmail doesn't support

  SPACE = ' '
  TAB   = '    ' # 1 character: a literal tab
  WS    = "$SPACE$TAB"

  VERBOSE = 'YES'

  :0
  *$ ^From:.*\/[^$WS].*
  {
    H_FROM = "$MATCH"

    :0
    * H_FROM ?? ()<\/[^(_at_)]+
    { USERID = "$MATCH " }
    :0E  # if there is no <, use anything up to the first @
    *$ H_FROM ?? [^(_at_)$WS]+@
    *  MATCH  ?? ^^\/[^(_at_)]+
    { USERID = "$MATCH " }
  }

(untested)

But there are better ways to get the clean from address, 
see for example Sean's CLEANFROM on 
http://www.professional.org/procmail/sandbox.html

-- 
Grtz, Ruud

____________________________________________________________
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>