RE: [PHP] plain text email address to hyperlink?
| From: | Jason Lotito | Date: | Fri, 18 May 2001 03:34:29 +0000 |
| Subject: | RE: [PHP] plain text email address to hyperlink? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-53378@lists.php.net to get a copy of this message | ||
> -----Original Message-----
> From: Robert Reed [mailto:reed@theextreme.net]
> Sent: Thursday, May 17, 2001 10:36 PM
> To: php-general@lists.php.net
> Subject: [PHP] plain text email address to hyperlink?
>
>
> 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,
You can find the code here:
http://www.newbienetwork.net/phpcodems.php?as=viewcode&id=6
Enjoy.
Jason Lotito
www.Newbienetwork.net