I am trying to write a regex that matches my string with below format:
- Total there will be 10 to 12 characters in a string.
- And first 3 characters are distinct uppercase letters.
- Then the next 4 characters represent the birth year and will always be between 1900 and 2019.
- The next characters represent the number which can be either of these {10,20,50,100,200,500,1000}.
- The last character is an uppercase letter.
I came up with below regex but having issues coming up for my third point. This line (1[9][0-9]{2}|2019) looks wrong and it doesn't work for string UYT20121000X:
^(([A-Z])(?!\2)([A-Z])(?!\2|\3)[A-Z])(1[9][0-9]{2}|2019)(10{1,3}|[25]00?)([A-Z])$
After using above regex I will extract the number which matches my fourth point.
^(([A-Z])(?!\2)([A-Z])(?!\2|\3)[A-Z])(?:19\d{2}|20[01]\d)(?:1000|[125]0?0)[A-Z]$regex101.com/r/uHCjPD/1