note 84879 deleted from function.preg-replace by danbrown
| From: | danbrown@php.net | Date: | Sun, 03 Aug 2008 14:39:24 +0000 |
| Subject: | note 84879 deleted from function.preg-replace by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-143125@lists.php.net to get a copy of this message | ||
Note Submitter: mohamedbadr dot com
Reason: spam
----
the function transform the URL in a text into link <a href to be clickable
<?php
function replace_plain_text_link($plain_text) {
$url_html = preg_replace('/(?<!S)((http(s?):\/\/)|(www.))+([w.1-9\&=#?-~%;]+)/',
'<a target=_blank href="http$3://$4$5">http$3://$4$5</a>',
$plain_text); return ($url_html); } echo replace_plain_text_link('hi this is dummy text before
the link http://www.smjdesign.com hi this is dummy text after
and also here is my personal website http://www.mohamedbadr.com please check the site')
?>