note 84879 added to function.preg-replace
| From: | mohamedbadrdotcom at osu1 dot php dot net | Date: | Sun, 03 Aug 2008 09:53:23 +0000 |
| Subject: | note 84879 added to function.preg-replace | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-143095@lists.php.net to get a copy of this message | ||
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')
?>
----
Server IP: 69.147.83.197
Probable Submitter: 212.138.113.12 (proxied: 212.26.82.20)
----
Manual Page -- http://www.php.net/manual/en/function.preg-replace.php
Edit -- https://master.php.net/note/edit/84879
Del: integrated -- https://master.php.net/note/delete/84879/integrated
Del: useless -- https://master.php.net/note/delete/84879/useless
Del: bad code -- https://master.php.net/note/delete/84879/bad+code
Del: spam -- https://master.php.net/note/delete/84879/spam
Del: non-english -- https://master.php.net/note/delete/84879/non-english
Del: in docs -- https://master.php.net/note/delete/84879/in+docs
Del: other reasons-- https://master.php.net/note/delete/84879
Reject -- https://master.php.net/note/reject/84879
Search -- https://master.php.net/manage/user-notes.php