Private Sub ValidatePassword(pwd As String,minLength As Int,numUpper As Int,numLower As Int,numNumbers As Int,numSpecial As Int) As Boolean
If pwd.Length < minLength Then Return False
If CountMatches(pwd,"[A-Z]") < numUpper Then Return False
If CountMatches(pwd,"[a-z]") < numLower Then Return False
If CountMatches(pwd,"[0-9]") < numNumbers Then Return False
If CountMatches(pwd,"[^a-zA-Z0-9]") < numSpecial Then Return False
' Passed all checks.
Return True
End Sub