Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

Re: Expressing myself - patterns for e-mail adresses

by bjelli (Pilgrim)
on May 12, 2001 at 12:25 UTC ( #79929=note: print w/replies, xml ) Need Help??

in reply to Expressing myself

I just realized I don't know if < needs to be escaped in patterns. I have this nagging feeling it should be, but I can't find anything in perlre.

Hm, this seems to work ok:

if (m/<(.*?)>/) { my $email = $1; if ($email =~ /@.*\./) { # ok, do something with it. } }

I first find stuff in < > (don't do it this way if you're parsing html, you'll match all the tags). Then I have a look inside, to see if there's a @ and a dot. I am wary of more elaborate checking for e-mail adresses - you always end up discarding some valid adresses.

Brigitte    'I never met a chocolate I didnt like'    Jellinek

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://79929]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (5)
As of 2018-06-23 16:18 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (125 votes). Check out past polls.