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
|
---|
In Section
Seekers of Perl Wisdom