Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

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
http://www.horus.com/~bjelli/         http://perlwelt.horus.at


Comment on Re: Expressing myself - patterns for e-mail adresses
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (13)
As of 2014-07-25 18:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (174 votes), past polls