note 54463 added to function.ereg-replace
| From: | zaczek at gmail dot com | Date: | Tue, 05 Jul 2005 11:09:53 +0000 |
| Subject: | note 54463 added to function.ereg-replace | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-91465@lists.php.net to get a copy of this message | ||
If you want the function to process query strings, such as:
http://www.php.net/index.php?id=10%32&wp=test
modify the function as follows:
function hyperlink(&$text)
{
// match protocol://address/path/
$text = ereg_replace("[a-zA-Z]+://([-]*[.]?[a-zA-Z0-9_/-?&%])*", "<a
href=\"\\0\">\\0</a>", $text);
// match www.something
$text = ereg_replace("(^| )(www([-]*[.]?[a-zA-Z0-9_/-?&%])*)", "\\1<a
href=\"http://\\2\">\\2</a>", $text);
}
----
Manual Page -- http://www.php.net/manual/en/function.ereg-replace.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+54463
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+54463&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+54463&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+54463&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+54463&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+54463&report=yes&reason=non-english
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+54463&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+54463&report=yes
Search -- http://master.php.net/manage/user-notes.php