[Melbourne-pm] OT: Re: FW: Bamboozled by perl
Toby Corkindale
toby.corkindale at strategicdata.com.au
Sun Oct 4 17:52:25 PDT 2009
Sam Watkins wrote:
>> text processing is where it really shines.
>
> # perl invocation to extract email addresses from text, 4 all ur spamming needs
> perl -ne 'print "$1\n" while /(\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b)/ig'
Which fails to match some email addresses.
You may want to use these CPAN modules, which follow the appropriate RFC:
http://search.cpan.org/~cwest/Regexp-Common-Email-Address-1.01/
http://search.cpan.org/~rjbs/Email-Address-1.889/
Hope this helps,
Toby
More information about the Melbourne-pm
mailing list