fork download
  1. <?php
  2.  
  3.  
  4. $pattern = '#((?:http|https|ftp)://(?:\S*?\.\S*?))(?:\s|\;|\)|\]|\[|\{|\}|,|"|\'|:|\<|$|\.\s)#i';
  5.  
  6. $data = "is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, http://w...content-available-to-author-only...e.com/watch?v=mm78xlsADgc when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but";
  7.  
  8. preg_match_all($pattern, $data, $matches);
  9.  
  10. var_dump($matches[1]);
Success #stdin #stdout 0.01s 20520KB
stdin
Standard input is empty
stdout
array(1) {
  [0]=>
  string(42) "http://w...content-available-to-author-only...e.com/watch?v=mm78xlsADgc"
}