tags:

views:

23

answers:

1

I'm having a hard time trying to create a right regular expression for the RegularExpressionValidator control that allows password to be checked for the following: - Is greater than seven characters. - Contains at least one digit. - Contains at least one special (non-alphanumeric) character.

Cant seem to find any results out there too. Any help would be appreciated! Thanks!

+1  A: 

Maybe you will find this article helpful. You may try the following expression

^.*(?=.{8,})(?=.*[\d])(?=.*[\W]).*$

and the breakdown:

  • (?=.{8,}) - contains at least 8 characters
  • (?=.*[\d]) - contains at least one digit
  • (?=.*[\W]) - contains at least one special character
Darin Dimitrov