VERP header regex

Carl Reynolds redhat-list at hyperbole-software.com
Fri Sep 30 18:02:59 UTC 2005


Opesh Alkara wrote:

>Can any one suggest me the REGEX that will work for all the VERP
>headers....the VERP header format is something like this:
>
>Example:
>
>verp-prefix-username=userdomain.com at mailinglistserver.com
>
>OR
>
>listname-user=domain at your.domain
>
> If the return path is something at yahoo.com <http://yahoo.com> and the
>recipient email is mynameisxyz at gmail.com, the verp address should be
>
> something-mynameisxyz=gmail.com at yahoo.com
>
>The REGEX should be able to parse any VERP header....
> Thanks much...
>
>--
>Regards
>Opesh Alkara
>  
>
You don't say what language you are trying to do this in, but, the 
syntax you are trying to parse is complex enough (with the e-mail 
address on the end of it) that you should be using several statements to 
try to parse these headers. You should also look at the *Email::Valid* 
<http://search.cpan.org/author/MAURICE/Email-Valid-0.15/Valid.pm> module 
from CPAN.

You can check the existence of the two records you listed as follows


use Email::Valid;

if  (    ($line =~ /^verp-prefix-username=(.*)$/)
      and (Email::Valid->address($1) )
     )
  { do-something }
elsif  (    ($line =~ /^listname-user=(.*)$/)
      and (Email::Valid->address($1) )
     )
  { do-something-else }


Try to give us a little more information if you want more help.



Carl.







More information about the redhat-list mailing list