Possible Duplicate:
Linkify Regex Function PHP Daring Fireball Method
I’m trying to get URLs from a string and i have this
$link_count = count(explode('http',$post));
if($link_count > 0){
preg_match_all("#https?://[^.\s]+\.[^\s]+#ix", $note, $matches);
foreach(){} etc..
}
The problem here is i also want to be able to detect URLs like this;
http://www.link.com or http://www.link.com or link.com
Ps: i’ve searched for similar questions on here but i haven’t seen one that adresses all those type of URLs.
Thank you.
Try this regular expression :