plain text email address to hyperlink?
| From: | Robert Reed | Date: | Fri, 18 May 2001 02:35:38 +0000 |
| Subject: | plain text email address to hyperlink? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-53372@lists.php.net to get a copy of this message | ||
I've attempted to use the following snippet to convert an email address
in plain text to a hyperlink, and while it works fine in a function to
verify an email address, it doesn't seem to work to replace all occurances
of an email address within a body of text.
$page =
eregi_replace("^[0-9a-z]+([-_./]([0-9a-z]+))*@[0-9a-z]+([-.]([0-9a-z]+))*\\.
[a-z]{2,4}$","<a href=\"\\1\">\\1</a>",$pageOne);
echo $page;
$pageOne is the body of text that has the email address(es) in it. Is there
a better way of doing this, or would I have to bend and use an array to scan
each word for an email address and then convert them from there?
Thanks in advance,
Robert Reed (reed@theextreme.net)
--------------------------------------
WWW -> http://www.theextreme.net
--------------------------------------
"I'd rather not even be than a man
that's staring in a mirror through me."
--------------------------------------