I want to find all links in the text like this:
Test text http://hello.world Test text http://google.com/file.jpg Test text https://hell.o.wor.ld/test?qwe=qwe T
Works like a charm. use this.
$str= "Test text http://hello.world"; preg_match_all('/\b(?:(?:https?|ftp|file):\/\/|www\.|ftp\.)[-A-Z0-9+&@#\/%=~_|$?!:,.]*[A-Z0-9+&@#\/%=~_|$]/i', $str, $result, PREG_PATTERN_ORDER); print_r($result[0]);