Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

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

by linuxer (Curate)
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__

Replies are listed 'Best First'.
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 all is quiet...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (2)
As of 2016-12-03 15:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:













    Results (56 votes). Check out past polls.