I'd like to setup a RegularExpressionValidator to ensure users are entering valid windows IDs in a textbox.
Specifically, I'd like to ensure it's any three capital letters (for our range of domains), followed by a backslash, followed by any number of letters and numbers.
Does anyo开发者_Python百科ne know where I can find some examples of this type of validation...or can somebody whip one up for me? :)
Language is VB.NET if it matters...
This should do it.
^[A-Z]{3}\\[A-Za-z0-9]+$
You may be able to abbreviate. To embed in a string in C# (if that's your language) you need to escape the backslashes:
"^[A-Z]{3}\\\\[A-Za-z0-9]+$"
If you want to restrict to known domains then:
^((AAA)|(BBB)|(CCC))\\...
Try this regex
^[A-Z]{3}\\\w+$
精彩评论