I need to find a template that restricts data entry. What I need to limit input:
The first character must be "S" The second character must be "S", "T", "W", "X" or "V", the next 6 must be numbers for 0 - 9, the last 2 can be any uppercase letter or any number 0 - 9
So, my research has led me to bring this together.
^[S][STWXV]/d{6}[A-Z0-9]{2}$
From what I read:
[S]means only the capital letter S
[STWXV]means any one letter from this list
/d{6}means 6 digits
[A-Z0-9]{2}means any 2 characters A - Z or 0 - 9
I'm not looking for a match anywhere in the string, I need the whole string to match this pattern.
So why Regex.IsMatch("SX25536101", "^[S][STWXV]/d{6}[A-Z0-9]{2}$")returns false?
Obviously, I was wrong, but this is my first attempt at regular expressions, and this does not make sense :(
source
share