Goal: RegEx to fit many posible NDC 10 & 11 formats.
I've made a great start... NDC 10:
^[0-9][0-9][0-9][0-9]\-[0-9][0-9][0-9][0-9]\-[0-9][0-9]$
e.g. 1234-1234-12
Reference
However, I've since learnt there are other formats and 11 digits:
- 4-4-2
- 5-3-2
- 5-4-1
- 5-4-2 (11 digits)
How can I write one RegEx for all these possibilities?
Issues:
- Optional 11th digit,
- Moving hyphen