Reputation: 5984
I am trying to write a regex to validate GMAT scores, which go from 200 - 800 in increments of 10. So far, I have been able to come up with validating all numbers from 200 - 800:
^([2-7][0-9]{2}|800)$
Can anyone help?
Upvotes: 2
Views: 407
Reputation: 1794
Isn't it?
^([2-7][0-9]0|800)$
Increments by 10 means it has to end by zero.
Upvotes: 1
Reputation: 191819
It seems like you just want to end with a literal 0
^([2-7][0-9]0|800)$
Upvotes: 4