简体   繁体   中英

Regular expression for allowing a user to enter alphanumeric characters and only one non-alphanumeric character

I am using Asp.Net/C# .I am using RegularExpressionValidator control for validating my password textbox .My passowrd field can allow alphanumeric characters and only one non-alphanumeric character.Can anybody how do I allow user to enter such a pattern. Any help will be much appreciated.

Thanks

Something like that? (Add anchors if necessary - not sure about how the validators apply the regex)

\w*(\W\w*)?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM