Trying to write Javax validation regex pattern to match any string with the following:
- Doesn’t start with 001, 002 or 003
- Starts with 3 digits followed by a hyphen, which is then followed by any letter, number, hyphen, $, + or _
- Contains 35-50 characters in total
What I have so far which works for the 2nd and 3rd requirements that I listed above:
“^[\w\-+\$_]{35,50}$”
Now I am trying to add the 1st requirement which I listed above, however I cannot seem to get it to work:
”^[?!(001|002|003)\-+\$_]{35,50}$”