regexp question: Get URLs from a string and convert to Links
Posted: Wed May 19, 2004 4:23 am
Hi!
Hm. Let us say that we have a string like the one belov.
How to find the URL's and convert them to links like belov?
Hope you did understand my question
I'm not so steady with regular expressions
Hm. Let us say that we have a string like the one belov.
Code: Select all
<?php
$string = "blablabla... http://site.com/dir/page.php?var=something blablabla... http://anothersite.com/ blablabla";
?>Code: Select all
<?php
$string = "blablabla... <a href="http://site.com/dir/page.php?var=something" target="_blank">http://site.com/dir/page.php?var=something</a> blablabla... <a href="http://anothersite.com/" target="\blank">http://anothersite.com/</a> blablabla";
?>I'm not so steady with regular expressions