Sub IsValidPwd(pwd As String, level As Int) As Boolean 'for strong password
Dim m As Matcher
Select level
Case 1 ' only 8 chrs
m = Regex.Matcher("(?=^.{8}$)(?=.*[0-9])(?=.*[A-Z])(?=.*[a-z])(?=.*[!@#$&*]).*$", pwd)
Case 2 'at least 8 chrs / 1 lower 1 upper
m = Regex.Matcher("(?=^.{8,}$)(?=.*[A-Z])(?=.*[a-z])(?=.[^<>%$#]*$)(^\D*$).*$", pwd)
Case 3 'at least 8 chrs / 1 lower 1 upper / 1 digits
m = Regex.Matcher("(?=^.{8,}$)(?=.*[0-9])(?=.*[A-Z])(?=.*[a-z])(?=.[^<>%$#]*$).*$", pwd)
Case 4 'at least 8 chrs / 1 lower 1 upper / 1 digits / 1 Special Chr
m = Regex.Matcher("(?=^.{8,}$)(?=.*[0-9])(?=.*[A-Z])(?=.*[a-z])(?=.*[!@#$&*]).*$", pwd)
End Select
If m.Find = False Then Return False
Return True
End Sub