3v4l.org

run code in 300+ PHP versions simultaneously
<?php $word = 'Song'; $string = "some words http://I_like_to_sing.mp3 and then some other words http://Another_song.mp3 and some words at the end..."; $regex = "/(https?:\/\/(?![^.]*$word).+?\.mp3)/i"; preg_match_all($regex, $string, $matches); print_r($matches[1]);

preferences:
32.7 ms | 405 KiB | 5 Q