Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic

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

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

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (4)
As of 2015-11-29 16:49 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (751 votes), past polls