I am attempting to match strings that would have a pattern of:
- two uppercase Latin letters
- two digits
- two uppercase Latin letters
- four digits
- ex: MH 45 LE 4098
There can be optional whitespaces between the first three and they need to be limited to these numbers of characters. I was trying to group them and set a limit on the characters, but I am not matching any strings that fall within the define parameters. I had attempted building a set like so template = '[A-Z{2}0-9{2,4}]'
, but was still receiving errors when the last digits had exceeded 4.
template = '(A-Z{2})\s?(\d{2})\s?(A-Z{2})\s?(\d{4})'
This was the other attempt when I tried being more verbose, but then couldn't match anything.