LPM: RE: Regexps for email (and digression)
0x29A [B.Vandgrift]
booberry at io.com
Wed Jan 26 14:05:17 CST 2000
On Wed, 26 Jan 2000 ken.rietz at asbury.edu wrote:
=>I'm with Dave -- not a regex expert and confused about why you are
=>having a problem. The regex you give works for me. Well, almost.
=>My e-mail is ken.rietz at asbury.edu, which fails to find the full
=>username. I'd recommend changing the substitution to
=>
=>$inline =~ s/\b([\w.]+\@\w+(\.\w+)*\.\w+)\b/<a
=>href=\"mailto:$1\">$1<\/a>/g;
Actually, I ended up using [\w.-_]. I couldn't think of any other symbols
I've seen on a regular basis. The problem was when the regexp was being
called (once for every key pair I was looping over, in fact), and was
fixed readily once my brain kicked in, and I got some lunch.
For reference, I used this line:
$inline =~ s{\b([.-_\w]+\@\w+(\.\w+)*?\.\w+)}
{<a href="mailto:$1">$1</a>}igox;
It actually works quite well. Thanks to all who responded.
--
Ben Vandgrift <booberry at io.com> http://www.io.com/~booberry
________________________________________________________________________
"I do not feel obliged to believe that the same God who has endowed us
with sense, reason, and intellect has inteded for us to forego their
use." --Galileo
More information about the Lexington-pm
mailing list