I have this code regex, which should transform all kind of diffrent urls into links in some text.
The preg_replace code is:
$regex = '@((https?://)?([-\w]+\.[-\w\.]+)+\w(:\d+)?(/([-\w/_\.]*(\?\S+)?)?)*)@';
$text = preg_replace($regex, '<a href="$1">$1</a>', $item);
now it works for almost all URLs you can imagine, but the problems i have are commas, and special characters in URLs...
The problem is making me:
http://www.sdfsdfsdf.sd/si/391,1000,1/more.html
http://sdfsddsdf-sdfsdfds.sr/component/option,com_contact/Itemid,3/lang,si/
Funny here at stackoverflow those two are OK :)
Thanks, best regards,