Validating composition of password

Hi All,

Looking for this: Module by Ken, looks to do exactly what I want to do:

a) is at least 8 characters long
b) contains at least one lowercase letter,
c) contains at least one uppercase letter,
d) contains at least one numeric digit, and
e) contains at least one special character (?)

Link in the post errors out. Does anyone have something similar or point to something?


Something like this?

Dim t As String = "Hello123!"

Dim HasLower As Boolean
Dim HasUpper As Boolean
Dim HasDigit As Boolean
Dim HasSpecial As Boolean

Dim lower As String = "abcdefghijklmnopqrstuvwxyz"
Dim digits As String = "0123456789"
Dim Special As String = "!§$%&/()=?#+*-_.:,;<>"

Dim l As Integer = LenB(t)
For i As Integer = 1 To l
  Dim c As String = MidB(t, i, 1)
  If lower.InStrB(c) > 0 Then
    HasLower = True
  Elseif upper.InStrB(c) > 0 Then
    HasUpper = True
  Elseif digits.InStrB(c) > 0 Then
    HasDigit = True
  Elseif Special.InStrB(c) > 0 Then
    HasSpecial = True
  End If

If l > 8 And HasLower And HasUpper And HasDigit And HasSpecial Then
  MsgBox "Great password!"
End If

But in general a password like “BobEatsHamburgsWithPickels” is easy to remember, but difficult to guess.

1 Like

Thank you so much Christian, exactly what I was looking for! And yes, I agree with your password example, it’s just that most “Best Practices” are looking for the above.

Thanks again!!

I searched Google and found a link where you can download Kem’s project here in the forum: How can a password be verified as conforming to...

1 Like

Thank Tim, I have downloaded as well!

Much appreciated!!