xernt.com




Xernt helps you find up-to-date answers & allows to take a part in building human knowledge database.
This Post below ↓ is only visible to you.
It is sheduled to delete with all the changelog & comment data attached. You can cancel deletion at any time.
4 weeks left
TIP. Editing item cancels the deletion shedule automatically.
PHP replace link function

PHP replace link functionEdit

 
 
You've got: http://... address and want to replace it with: http://.... Working PHP replace link function.


function rplc($x,$style='') {
$x = ereg_replace('[-a-z0-9!#$%&\'*+/=?^_`{|}~]+@([.]?[a-zA-Z0-9_/-])*','\\0',$x);
$x = ereg_replace("[[:alpha:]]+://[^<>[:space:]]+[[:alnum:]/]","\\0",$x);
return $x;
}

?>
Edit
Comment · pm2  · 2 years ago
``
function rplLnk($x,$style='') {
$x = ereg_replace('[-a-z0-9!#$%&'*+/=?^_`{|}~]+@([.]?[a-zA-Z0-9_/-])*','<a href='mailto:\0' '.$style.'>\0</a>',$x);
$x = ereg_replace("[[:alpha:]]+://[^<>[:space:]]+[[:alnum:]/]", "<a href='\0' $style>\0</a>", $x);
$x = preg_replace(',(?<!//)www.[^<>[:space:]]+[[:alnum:]/],i','<a href="http://"></a>',$x);
return $x;
}
`` – Andrzej Jeziorski  2 months ago · Reply
Please login or create an account to post a comment.
Follow Post
Related Posts
2,773 views


 
 
131 online
About · Blog · Explore · Privacy · Terms · Help  up

These items will be permanently deleted and cannot be recovered. Are you sure?