note 13744 added to ref.strings.php
| From: | jason at greenhell dot com | Date: | Sat, 30 Jun 2001 22:00:17 +0000 |
| Subject: | note 13744 added to ref.strings.php | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-14830@lists.php.net to get a copy of this message | ||
Here are 2 rather handy regular expressions I use for automatical in-lining text to HTML (AKA
url_clickable):
For mailto links:
eregi_replace("([
]+)([[:alnum:]\.\-]+\@[[:alnum:]\-]+\.[\.[:alnum:]]+)([^\.[:alnum:]])","\\1<a
href=\"mailto:\\2\">\\2</A>\\3", $string;
for urls:
eregi_replace("(![\"])((http|https|ftp)\:\/\/[[:alnum:]\-]+\.[[:alnum:]\-]+[^[:space:]]*.)","<a
target=_new href=\"\\1\">\\1</a>", $string);
http://www.php.net/manual/en/ref.strings.php