Это регулярное выражение будет работать для вас:
's/^[a-z0]+(\d+).*$/\1/i'
Пояснение:
^ - start of the text
[a-z0]+ - match 1 or more of a-z alphabets or number 0
\d+ - match 1 or more decimal number
(\d+) - group these numbers to be back referenced later
.* - match 0 or more any characters
$ - end of text
\1 - replace with back reference # 1 which is what we have in brackets (\d+)
/i - ignore case
Таким образом, в строке AB01234-01B
он группирует 1234 вместе, используя (\ d +) после сопоставления AB0, и заменяет всю строку на 1234
.