开发者

RegularExpressionValidator - Windows ID Validation

开发者 https://www.devze.com 2022-12-25 00:26 出处:网络
I\'d like to setup a RegularExpressionValidator to ensure users are entering valid windows IDs in a textbox.

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+$
0

精彩评论

暂无评论...
验证码 换一张
取 消