25 April 2013

Check Password in Vb.net

Today,we will discuss about the Password Checking using regular Expression in VB.net
Here is a Sample code for Password Checking using Regular Expression in VB.Net

Dim reg As Regex
 reg = New Regex("^(?=.*d)(?=.*[a-z])(?=.*[A-Z]).{6,10}$")
Dim mat As Match = reg.Match(TextBox1.Text)
If mat.Success = False Then
MessageBox.Show("Please enter at least one upper case letter, one lower case letter, and one numeric digit.")
TextBox1.Text = ""
End If

No comments: