3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string = "hi new image one http://xxx/images/c4ca4238a0b923820dcc509a6f75849b208754572.jpgand two arehttp://yyy/images/c1f1a611c1147c4054c399c01f8bad76686484492.jpgend"; $regex = '#https?://[^,\s()<>]+(?:\([\w\d]+\)|([^,[:punct:]\s]|/)\.(jpg|jpeg))#'; preg_match_all($regex, $string, $matches); echo "<pre>"; print_r($matches[0]);

preferences:
29.6 ms | 405 KiB | 5 Q