tags:

views:

116

answers:

3

I have the following regex that requires 1 number, 1 letter upper and 1 letter lower (w/ a minimum of 8 length)

Regex.IsMatch(password, "^(?=.*[0-9])(?=.*[a-z])(?=.*[A-Z]).{8,}$")

I need to add another filter to ensure one of the following special characters is present (any help?)

#, $, @, !, %, &, * ?
+6  A: 

Simple!:

Regex.IsMatch(Password,"[#$@!%&*?]");

Erich
+2  A: 

How about this? [#$@!%&*?]

Steven
both looks like swearing, :)
Makach
+1  A: 

Regex.IsMatch(password, "^(?=.*[0-9])(?=.*[a-z])(?=.*[A-Z])(?=.*[#$@!%&*?]).{8,}$")

macek