Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^3: How to extract an email address from a mailto URL?

by linuxer (Deacon)
on Dec 30, 2008 at 14:07 UTC ( #733247=note: print w/ replies, xml ) Need Help??


in reply to Re^2: How to extract an email address from a mailto URL?
in thread How to extract an email address from a mailto URL?

Well, first install these two modules (and their unresolved dependencies if there are any):

Then you can do something like this (Quickshot, untested):

#!/usr/bin/perl use strict; use warnings; use Regexp::Common qw(Email::Address); use Email::Address; my $filename = 'file_to_parse.dat'; open my $rh, '<', $filename or die "$filename: $!"; # Requirement: href=, mailto: and the mailaddress must be in the same +line! my @addresses = map { m/mailto:($RE{Email}{Address})/o; $1 } grep { m/href=.+?mailto:/ } <$rh> ; close $rh; { local $, = local $\ = "\n"; print @addresses; } __END__


Comment on Re^3: How to extract an email address from a mailto URL?
Download Code
Re^4: How to extract an email address from a mailto URL?
by jdlev (Scribe) on Dec 30, 2008 at 16:09 UTC
    Thanks, works great!

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://733247]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (7)
As of 2014-12-27 02:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (176 votes), past polls