ESHAN
Please Help Any Helpless Person
23 February, 2010
Replace Links With Html
You can replace links with html tag using PHP regular expression.
Here is an example of it.
function replace_link_with_link($string)
{
$pattern = "|http://(\w+)([A-Z0-9-_:./?]+)*|i";
$string = preg_replace($pattern,'<a href="\0">\0</a>',$string);
return $string;
}
Enjoy. Help Helpless.
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment