check string equal with regular expression python

import re
pattern = re.compile("^([A-Z][0-9]+)+$")

Here is what the above code is Doing:
1. We’re creating a regular expression pattern that matches a string that starts with a capital letter, followed by a number, and then any number of capital letters and numbers.
2. We’re using the match() method to see if the string matches the regular expression.
3. If the string matches the regular expression, the match() method returns a Match object. Otherwise, it returns None.