use regex to see if characters are the same python code example
Example 1: check string equal with regular expression python
import re
pattern = re.compile("^([A-Z][0-9]+)+$")
pattern.match(string)
Example 2: Python Regex documentation\
>>> import re
>>> m = re.search('(?<=abc)def', 'abcdef')
>>> m.group(0)
'def'