3v4l.org

run code in 300+ PHP versions simultaneously
<?php $strings = [ "A12B8Y9CC10", "V5C8I17", "KK18II9", "I8VV22ZZ4S9U2", "A18Z12I" ]; $pattern = '/[A-Z]{2,}\d+(*SKIP)(*FAIL)|[A-Z](\d+)/'; foreach ($strings as $string) { preg_match_all($pattern, $string, $matches); print_r($matches[1]); }

preferences:
26.33 ms | 405 KiB | 5 Q