I have this text:
$string = \"this is my friend\'s website http://example.com I think it is coll\";
How can I extract the link into another
preg_match_all('/[a-z]+:\/\/\S+/', $string, $matches);
This is an easy way that'd work for a lot of cases, not all. All the matches are put in $matches. Note that this do not cover links in anchor elements (