[Melbourne-pm] OT: Re: FW: Bamboozled by perl

Sam Watkins sam at nipl.net
Sun Oct 4 21:23:23 PDT 2009

On Mon, Oct 05, 2009 at 11:52:25AM +1100, Toby Corkindale wrote:
> 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:

It doesn't fail to match any email addresses that are actually used by anyone.
The RFC-based regexps on email addresses are brain-damaged in the extreme, no
one uses comments inside emails and all that crap.  One should follow what is
actually done, not the RFC.

and he is not actually trying to match email addresses, is was just an example.


More information about the Melbourne-pm mailing list