So I am trying to create a regex for MBIs (medical beneficiary identifiers) in python and my regexes wont work.
Any example of a MBi is: 1EG4-TE5-MK73
Here is the format to MBIs:
11-Characters
The MBI’s 2nd, 5th, 8th, and 9th characters will always be a letter.
Characters 1, 4, 7, 10, and 11 will always be a number.
I have tried using the following regex but to no avail:
mbi=re.compile(r"[1-9]{1}[^SLOIBZsloibz|^0-9]{1}[^SLOIBZsloibz]{1}[0-9]{1}-?[^SLOIBZsloibz|^0-9]{1}[^SLOIBZsloibz]{1}[0-9]{1}-?[^SLOIBZsloibz|^0-9]{1}[^SLOIBZsloibz|^0-9]{1}[0-9]{1}[0-9]{1}")
Any suggestions?!?!
Here is the format to MBIs:
- 11-Characters
- The MBI’s 2nd, 5th, 8th, and 9th characters will always be a letter.
- Characters 1, 4, 7, 10, and 11 will always be a number.
There's no mention about the 3rd and 6th characters, but based on your example, you can use a regex like:
\b\d[A-Z]{2}\d-[A-Z]{2}\d-[A-Z]{2}\d{2}\b