3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $string = "google.at;davetrudes.com asdf http://www.youtube.com/user/davetrudes http://code.google.com/u/dave.trudes/"; $match = null; preg_match_all('#\bhttps?://[^\s()<>]+(?:\([\w\d]+\)|([^[:punct:]\s]|/))#', $string, $match); var_dump($match);
Output for 4.3.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
array(2) { [0]=> array(2) { [0]=> string(38) "http://www.youtube.com/user/davetrudes" [1]=> string(37) "http://code.google.com/u/dave.trudes/" } [1]=> array(2) { [0]=> string(1) "s" [1]=> string(1) "/" } }