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:
106.68 ms | 1659 KiB | 5 Q