Reputation: 558
I would find validate the following syntax using regex from zero to 99, then "x", then again 0 to 99.
Example:
03x10
01x08
99x99
Upvotes: 0
Views: 79
Reputation: 2282
Try this:
From 0 to 99
^[0-9][1-9]?x[0-9][1-9]?$
To allow from 00 to 99:
^[0-9][0-9]?x[0-9][0-9]?$
Upvotes: 1
Reputation: 174844
Don't forget to include start ^
and end $
anchors in your regex.
^\d{2}x\d{2}$
\d{2}
will match exactly two digits.Upvotes: 3