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]\K\d+/'; foreach ($strings as $string) { preg_match_all($pattern, $string, $matches); print_r($matches[0]); }
Output for 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.33, 8.2.0 - 8.2.29, 8.3.0 - 8.3.27, 8.4.1 - 8.4.14
Array ( [0] => 12 [1] => 8 [2] => 9 ) Array ( [0] => 5 [1] => 8 [2] => 17 ) Array ( ) Array ( [0] => 8 [1] => 9 [2] => 2 ) Array ( [0] => 18 [1] => 12 )

preferences:
98 ms | 407 KiB | 5 Q