note 46491 deleted from function.preg-replace by tularis
| From: | tularis@php.net | Date: | Sun, 18 Jun 2006 13:20:46 +0000 |
| Subject: | note 46491 deleted from function.preg-replace by tularis | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-114331@lists.php.net to get a copy of this message | ||
Note Submitter: FP <firman at pribadi dot or dot id>
----
just my 2cent tips for auto-linking url in text
- without "href=" defined!, if you need, modify it.
- it should work for any type url , modify it for specific protocol.
- just remove " //WRAPPED// ", so its became one line
more 2cent tips at http://sysadmin.eu.org/?blog_cat=code
<?php
$result = preg_replace("/((http|ftp)+(s)?:(\/\/)([\w]+(.[\w]+)) //WRAPPED//
([\w\-\.,@?^=%&:;\/~\+#]*[\w\-\@?^=%&:;\/~\+#])?)/i", "<a
href=\"\\0\">\\0</a>", $text);
?>