3v4l.org

run code in 300+ PHP versions simultaneously
<?php $strings = [ "cricket-ck-game-play", "hand-ball-hb-game-play", "volley-ball-vb-game-play", "soccer-sc-game-play" ]; $pattern = "/\b(\w{3,}(?:-(?:\w{3,}))*)-(\w{2})-game-play\b/"; foreach ($strings as $str) { preg_match($pattern, $str, $matches); print_r($matches); }

preferences:
37.39 ms | 405 KiB | 5 Q