3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str="www.google.com"; $pattern = '#(www\.|https?://)?[a-z0-9]+\.[a-z0-9]{2,4}\S*#i'; preg_match_all($pattern, $str, $matches, PREG_PATTERN_ORDER); echo $matches[0];

preferences:
36.95 ms | 402 KiB | 5 Q