Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
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?
[Discipulus]: <code> code and data</code>
[Discipulus]: amitkumarj441 more atention you put asking, more attentio you got in answers
Discipulus 's hoping he needs a oneliner ;=)
VinsWorldcom takes a cookie from the platter on the sideboard.

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (6)
As of 2017-04-26 20:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I'm a fool:











    Results (488 votes). Check out past polls.