Regular expression to match any number unless it's followed by a given character

Solution 1:

The quantifiers in the pattern .*(\d+)(?!A) allow backtracking, so the the \d+ that matches 12 in 12A can backtrack one position and have the lookahead evaluate to true.

You can match capture 1+ digits, followed by matching any char except A or a digit, or assert the end of the string

(\d+)(?:[^A\d]|$)

Regex demo

Or if possessive quantifiers are supported, that not allow backtracking after there is a match, and you can get a match only without the capture group:

\d++(?!A)

Regex demo