<?php $pattern = "/-([a-z]{2})-.*/"; $strings = [ "cricket-ck-game-play", "hand-ball-hb-game-play", "volley-ball-vb-game-play", "soccer-sc-game-play" ]; foreach ($strings as $str) { print_r(preg_split($pattern, $str, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY)); }
You have javascript disabled. You will not be able to edit any code.