| Liam Delahunty: Home | Tips | Web | Contact | 
|---|
| 
 
Recommended laptop 
under £500. Think I deserve a present? See my Amazon Wish List  | 
   
Convert URLs into a linkIn a comments field, from your log analysis or via your own spidering you may want to turn the urls you get into links. In php you can do the following: 
$str = ereg_replace("[[:alpha:]]+://[^<>[:space:]]+[[:alnum:]/]","<a href=\"\\0\">\\0</a>", $str);
There may be occations when you want to add the  
$str = ereg_replace("[[:alpha:]]+://[^<>[:space:]]+[[:alnum:]/]","<a href=\"\\0\" rel=\"nofollow\">\\0</a>", $str);
Share this!  |