3v4l.org

run code in 500+ PHP versions simultaneously
<?php $str = 'xxABC1xxxABC2xx'; if ( preg_match('/\d[A-Z]+x/', strrev($str), $match) ) echo strrev($match[0]);

preferences:
22.29 ms | 476 KiB | 4 Q