Priyank Patel
Priyank Patel

Reputation: 6996

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

Upvotes: 0

Views: 705

Answers (1)

Lucero
Lucero

Reputation: 60190

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

\w*(\W\w*)?

Upvotes: 2

Related Questions