I have searched but I can't find a simple method to remove links of the form www.website.com or .co.uk etc from a string. I have found regular expressions that remove urls that start with http:// but not straightforward www ones. Any suggestions?
This is the code I have got to remove urls from a string called $data:
$data = preg_replace('/\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~|$!:,.;]*[A-Z0-9+&@#\/%=~|$]/i', '', $data);
This simply deletes any links, so it will remove for example http://www.junkwebsite.com/ but not www.junkwebsite.com.
Thanks for any suggestions.