Skip to main content
fixed for symbol-first passwords.
Source Link
agent-j
  • 28k
  • 5
  • 55
  • 81

\w*$ will only match letters, numbers, and underscore. This is what you want:

Regex.IsMatch("jpere33z@1"@1?hs"hsjpere33z", @"^(?=\w*\d=.*?\d)(?=\w*[a=.*?[a-z])(?=\w*\W=.*?\W).*$"), RegexOptions.IgnoreCase)

I moved the validation to the left, and added \w* right before the \W. Edit: Also used .* instead of \w for test lookaheads.

\w*$ will only match letters, numbers, and underscore. This is what you want:

Regex.IsMatch("jpere33z@1?hs", @"^(?=\w*\d)(?=\w*[a-z])(?=\w*\W).*$") 

I moved the validation to the left, and added \w* right before the \W.

\w*$ will only match letters, numbers, and underscore. This is what you want:

Regex.IsMatch("@1?hsjpere33z", @"^(?=.*?\d)(?=.*?[a-z])(?=.*?\W).*$", RegexOptions.IgnoreCase)

I moved the validation to the left, and added \w* right before the \W. Edit: Also used .* instead of \w for test lookaheads.

Source Link
agent-j
  • 28k
  • 5
  • 55
  • 81

\w*$ will only match letters, numbers, and underscore. This is what you want:

Regex.IsMatch("jpere33z@1?hs", @"^(?=\w*\d)(?=\w*[a-z])(?=\w*\W).*$") 

I moved the validation to the left, and added \w* right before the \W.