Re: Assigning pattern matches to an array
- From: "Graham Stow" <graham@xxxxxxxxxxxx>
- Date: Sat, 30 Dec 2006 21:27:53 -0000
"DJ Stunks" <DJStunks@xxxxxxxxx> wrote in message
news:1167506565.933525.68510@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Graham Stow wrote:
push(@matches, $line=~/\b\w+@\w+\b/g); did it for me
The pattern doesn't match an email address, but I can work on that...
well, for one thing, the \w metacharacter doesn't match a literal .
don't roll your own email address regexp.
perldoc Email::Address
-jp
Emaill::Address doesn't grab me
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
Graham
.
- Follow-Ups:
- Re: Assigning pattern matches to an array
- From: DJ Stunks
- Re: Assigning pattern matches to an array
- From: Paul Lalli
- Re: Assigning pattern matches to an array
- References:
- Assigning pattern matches to an array
- From: Graham Stow
- Re: Assigning pattern matches to an array
- From: John W. Krahn
- Re: Assigning pattern matches to an array
- From: Uri Guttman
- Re: Assigning pattern matches to an array
- From: Graham Stow
- Re: Assigning pattern matches to an array
- From: DJ Stunks
- Assigning pattern matches to an array
- Prev by Date: MIDI::Score: Duration < 0, Adding Events, Native NRPNs?
- Next by Date: Problem by pushing a String and a Hash on an array!
- Previous by thread: Re: Assigning pattern matches to an array
- Next by thread: Re: Assigning pattern matches to an array
- Index(es):
Relevant Pages
|