I am trying to add a "RegularExpression" attribute to a property in a ViewModel
[RegularExpression(@"^(?=^.{8,}$)(?=.*\d)(?=.*\W+)(?=.*[a-z])(?=.*[A-Z])(?i-msnx:(?!.*pass|.*password|.*word|.*god|.*\s))(?!^.*\n)^((.))+$.*$", ErrorMessage = "Password does not meet requirements.")]
public string NewPassword { get; set; }
When the validation occurs, I get the following exception from Visual Studio:
Microsoft JScript runtime error: Syntax error in regular expression
This is the same exact regular expression that I am defining in the web.config when defining the Membership provider:
passwordStrengthRegularExpression="^(?=^.{8,}$)(?=.*\d)(?=.*\W+)(?=.*[a-z])(?=.*[A-Z])(?i-msnx:(?!.*pass|.*password|.*word|.*god|.*\s))(?!^.*\n)^((.))+$.*$"
Can someone tell me why I am getting this error when using the regular expression in the Model attribute?
god?