note 70632 added to function.eregi-replace
| From: | VladimirLuchaninov at osu1 dot php dot net | Date: | Sun, 22 Oct 2006 14:38:17 +0000 |
| Subject: | note 70632 added to function.eregi-replace | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-118975@lists.php.net to get a copy of this message | ||
If you have plain text e-mails and links but need to make them real links
<?
function replaceLinks($text) {
// convert support@pogoda.in into
// <a href="mailto:support@pogoda.in">
// support@pogoda.in</a>
$text = ereg_replace('[-a-z0-9!#$%&\'*+/=?^_`{|}~]+@([.]?[a-zA-Z0-9_/-])*',
'<a href="mailto:\\0">\\0</a>',$text);
// convert http://www.pogoda.in/new_york/eng/ into
// <a href="http://pogoda.in/new_york/eng/">
// pogoda.in/new_york/eng/</a>
$text = ereg_replace('[a-zA-Z]+://(([.]?[a-zA-Z0-9_/-])*)',
'<a href="\\0">\\1</a>',$text);
// convert www.pogoda.in/new_york/eng/ into
// <a href="http://www.pogoda.in/new_york/eng/">
// www.pogoda.in/new_york/eng/</a>
$text = ereg_replace('(^| )(www([-]*[.]?[a-zA-Z0-9_/-?&%])*)',
' <a href="http://\\2">\\2</a>',$text);
return $text;
}
?>
----
Server IP: 66.163.161.117
Probable Submitter: 194.146.112.113
----
Manual Page -- http://www.php.net/manual/en/function.eregi-replace.php
Edit -- https://master.php.net/note/edit/70632
Del: integrated -- https://master.php.net/note/delete/70632/integrated
Del: useless -- https://master.php.net/note/delete/70632/useless
Del: bad code -- https://master.php.net/note/delete/70632/bad+code
Del: spam -- https://master.php.net/note/delete/70632/spam
Del: non-english -- https://master.php.net/note/delete/70632/non-english
Del: in docs -- https://master.php.net/note/delete/70632/in+docs
Del: other reasons-- https://master.php.net/note/delete/70632
Reject -- https://master.php.net/note/reject/70632
Search -- https://master.php.net/manage/user-notes.php