Python: Regex matching query, find matching digits inside the string

We have created an invoice numbering rule, in which the default pattern is AA-{num(x)}/{YYYY}.

So let's say the first user which logged in didn't care about his pattern, and he started creating invoices. He has created few invoices and the last one that he managed to create had a numbering rule which is AB-003/2021. Everything seems cool and the back-end validation is pretty much working, but as I little did know the user is still able to make a custom pattern, for example, let's say that he can set the pattern to SZ{num(x)}. So let's say that the user wants to change the rule to this pattern and he starts using this SZ51 rule.

The main problem is that our back-end server would eventually crash because we have only created a validation for this default AA-{num(x)}/{YYYY} pattern.

As I spoke to one of our senior team lead back-end developers, he told me that we can start cutting the string from the right and loop every char and see if it is a digit or not. But if the user is able to set every pattern that he wants, that's a difficult thing to maintain.

What if the user wants this pattern - 2021/AB003 or ABX41 without anything...

So this is our code for the default pattern.

@staticmethod
def validate_number_no(old, new):
    ost, omid, oend = re.split("[-/]", old)
    nst, nmid, nend = re.split("[-/]", new)
    if len(omid) != len(nmid):
        return False
    if not omid.isdigit() or nmid.isdigit():
        return False
    if ost != nst or oend != nend:
        return False
    elif int(nmid) < int(omid):
        return False
    else:
        return True

def update(self, instance, validated_data):
    old_invoice_no = instance.number
    new_invoice_no = validated_data.get('number')

    if old_invoice_no != new_invoice_no:
        val = self.validate_number_no(old_invoice_no, new_invoice_no)
        if val is False:
            raise ValidationError('msg_error_malformed_invoice_number_pattern')

    validated_data = self._update_validated_data(validated_data)
    instance = super().update(instance, validated_data)
    self._update_customer(validated_data, instance)
    return instance

And on this code I got this comment from our senior dev:

What happens if the user has a custom pattern? for instance AS33