import re test_string = 'a1b2cdefg' matched = re.match("[a-z][0-9][a-z][0-9]+", test_string) is_match = bool(matched) print(is_match)