3v4l.org

run code in 300+ 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_pregex = 'https?://[-a-zA-Z()0-9@:%_+.~#?&;//=]+'; $pregex = "\\s*=\\s*['\"]?\\s*$url_pregex|($url_pregex)"; preg_match_all('`' . $pregex . '`i', $html, $matches); echo "Matches<br><pre>"; var_export(array_values(array_filter($matches[1]))); echo "</pre>";

preferences:
24.76 ms | 407 KiB | 5 Q