Hi all -
I am trying to validate the creation of new passwords.
I am trying to force users to use at least one digit, lower and uppper case letter.
The code i am using is from a video showing a user using VS2003. However, I am using vs2005 - i'm not sure if this is affecting it.
The code I am using returns an error no matter what I enter into the form (including values that should be OK).
Can you spot any errrors in my regular expression string (or anywhere here, really)?
Here is my code:
Code:Private Sub TextBox1_Validated(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox1.Validated If Regex.IsMatch(Me.PasswordTextBox.Text, "^(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{4,20}$") = True Then Me.ErrorProvider1.SetError(Me.TextBox1, Nothing) MsgBox("Match!!") Else Me.ErrorProvider1.SetError(Me.TextBox1, "Invalid Password") MsgBox("No Match!!") End If End Sub




)?
Reply With Quote