3v4l.org

run code in 500+ PHP versions simultaneously
<?php $html = " http://www.url1.com/ = ' http://www.url2.com/ 'http://www.url3.com/ <a href='http://www.url4.com/'>Testing1</a> <img src='https://url5.com'>Testing2</a>"; $url_regex = 'https?://[-\w()@:%+.~#?&;/=]+'; $regex = "`\s*=\s*['\"]?\s*$url_regex(*SKIP)(*FAIL)|$url_regex`i"; var_export(preg_match_all($regex, $html, $matches) ? $matches[0] : []);
Output for 8.1.0 - 8.1.34, 8.2.0 - 8.2.30, 8.3.0 - 8.3.30, 8.4.1 - 8.4.18, 8.5.0 - 8.5.3
array ( 0 => 'http://www.url1.com/', 1 => 'http://www.url3.com/', )

preferences:
67.18 ms | 980 KiB | 4 Q