Re: Assigning pattern matches to an array



Paul Lalli wrote:
Graham Stow wrote:
Done a quick test between
use Email::Address
push(@matches, Email::Address->parse($line));
and
push(@matches, $line=~/\b[.-\w]*@[-\w]*\.+[-\w]*\.*[-\w]*\b/g);
The latter pulled up a number of correct email address, while the former
pulled these up plus other stuff that weren't true email addresses

Could you post some example data showing that?

Says you. I trust Email::Address's belief of what a "true" email
address is a hell of a lot better than yours. Just because they don't
look like what you might consider "normal" addresses doesn't mean they
aren't valid. Email::Address follows the RFC. Your handrolled
solution does not.

I suspect that a library that accepts _all_ RFC 822 compliant addresses isn't an adequate tool for parsing out substrings from any document that are likely email addresses.

--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
.