Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
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?
[Tux]: Isaris was my personal favorite, then probably all of Pilion, then Apollonas (Naxos), Parga (westcoast), Egina, Crete, and a lot more
[Tux]: but the best places are far away from airports
[Tux]: though Nauplion is worth a visit and is very well reachable by public transport
[Tux]: afk
[Discipulus]: thanks i'll look

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (6)
As of 2018-07-18 08:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    It has been suggested to rename Perl 6 in order to boost its marketing potential. Which name would you prefer?















    Results (387 votes). Check out past polls.

    Notices?