Consider this (very simplified) example string:
1aw2,5cx7
As you can see, it is two digit/letter/letter/digit values separated
digit/letter/letter/digit
Since you're already using re, why not use string processing to manage the pattern repetition as well:
pattern = "P,P".replace("P",r"\d\w\w\d") re.match(pattern, "1aw2,5cx7")
OR
P = r"\d\w\w\d" re.match(f"{P},{P}", "1aw2,5cx7")