note 42824 added to function.preg-replace
| From: | KyleBarrow at rn2 dot php dot net | Date: | Mon, 31 May 2004 01:52:30 +0000 |
| Subject: | note 42824 added to function.preg-replace | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-70326@lists.php.net to get a copy of this message | ||
Yet another simple URL link maker. This one ignores any period at the end of the URL which is
usually a good thing:
function MakeUrl($strUrl)
{
$strUrl = preg_replace("/(http(s)?:\\/\\/[^\\s\\n]*)\\b(\\/)?/i","<a
href=\\"\\\\0\\">\\\\0</a>",$strUrl);
return $strUrl;
}
MakeUrl("Blah, blah, http://php.net/.");
// result: "Blah, blah, <a href="http://php.net/">http://php.net/</a>."
----
Manual Page -- http://www.php.net/manual/en/function.preg-replace.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+42824
Delete -- http://master.php.net/manage/user-notes.php?action=delete+42824&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+42824&report=yes
Search -- http://master.php.net/manage/user-notes.php