RE: Re[2]: Help - How to unwind an SRS address?

Mark <[email protected]> Sun, 21 Nov 2004 00:53:46 GMT
Newsgroups gmane.mail.spam.srs.general
Organization Asarian-host
Message-ID <[email protected]>
> -----Original Message-----
> From: [email protected] 
> [mailto:[email protected]] On Behalf Of Chris Drake
> Sent: zondag 21 november 2004 0:54
> To: Tom Lahti
> Subject: Re[2]: [srs-discuss] Help - How to unwind an SRS address?

> Relatedly - is there any way or regexp to recognize an SRS rewritten
> address?

I can give you this:

sub unwind_srs {
   (my $address = (shift)) =~ s/[<>]//g;
    if (($address =~ /^SRS0[+-=]\S+=\S{2}=(\S+)=(\S+)\@\S+$/i) ||
        ($address =~ /^SRS1[+-=]\S+=\S+==\S+=\S{2}=(\S+)=(\S+)\@\S+$/i)) {
        return ("$2\@$1");
    } else {
        return undef;
    }
}

if ($address = unwind_srs ('[email protected]')) {
   ...

No point in matching database SRS0 addresses (there is no SRS1 address
variant for the database address, btw), as there is nothing usable to
extract from them anyway.

- Mark 
 
        System Administrator Asarian-host.org
 
---
"If you were supposed to understand it,
we wouldn't call it code." - FedEx