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:
93.7 ms | 1665 KiB | 5 Q