Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

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

by jdlev (Scribe)
on Dec 30, 2008 at 13:17 UTC ( #733238=note: print w/ replies, xml ) Need Help??


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

My experience in perl is going on about 3 weeks...so some of what you are saying is greek to me. Can you provide an example of how you would do it? The source file to pull the information from has the tag as follows:

showTollfree(1010)
// -->
'/script'
Fax:  (301)931-1285 
'br''a
href='mailto:KHargrove@servpro1010.com'>KHargrove@servpro1010.com'/a'

'/td'

I'm sorry to have to be wet nursed through this...but I have learned a ton of stuff over the last few weeks...I feel like my brain is going to explode!


Comment on Re^2: How to extract an email address from a mailto URL?
Re^3: How to extract an email address from a mailto URL?
by linuxer (Deacon) on Dec 30, 2008 at 14:07 UTC

    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__
      Thanks, works great!

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (6)
As of 2014-12-21 02:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

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





    Results (101 votes), past polls