note 39683 added to function.preg-replace
| From: | dma147 at web dot de | Date: | Sat, 07 Feb 2004 14:01:29 +0000 |
| Subject: | note 39683 added to function.preg-replace | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-64768@lists.php.net to get a copy of this message | ||
I've a little correction to the upper post from "syd_egan at hotmail dot com".
To parse urls with a "-" or something else in it too, the preg_replce must look like this:
$text = preg_replace( "
(http|ftp)+(s)?:(//)((\w|\.|\-|_)+)(/)?(\S+)?i",
"<a href=\"\\0\" target=\"_blank\">\\4</a>", $text);
:)
----
Manual Page -- http://www.php.net/manual/en/function.preg-replace.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+39683
Delete -- http://master.php.net/manage/user-notes.php?action=delete+39683&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+39683&report=yes
Search -- http://master.php.net/manage/user-notes.php