Basically i am trying to parse "www.blah.com/efdsf" kinda thing in my forum script.
I have it work when an address has "http://" behind it but not when "www." is on it's own.
Here is my code:
Second one should parse with "www." on it's own but it doesn't.
I have it work when an address has "http://" behind it but not when "www." is on it's own.
Here is my code:
PHP:
$post = preg_replace("`\b(https?|ftp|file)://[-A-Za-z0-9+&@#/%?=~_|!:,.;]*[-A-Za-z0-9+&@#/%=~_|]\b`", '<a href="\0" target="_blank">\0</a>', $post);
$post = preg_replace("/\s(www\.([a-z][a-z0-9_\..-]*[a-z]{2,6})([a-zA-Z0-9\/*-?&%]*))\s/i", " <a href=\"http://$1\">$1</a> ", $post);
Second one should parse with "www." on it's own but it doesn't.







