I need to match a string that optionally ends with numbers, but only if the numbers aren't preceded by a 0.
so AAAA should match, AAA1 should, AA20 should, but AA02 should not.
I can figure out the optionality of it, but I'm not sure if python has a "preceded by" or "followed by" flag.
if s.isalnum() and re.match("^[A-Z]+[1-9][0-9]*$", s):
return True
^[A-Z]+(?!0)\d*$(Just to mention, prefer selected answer)