Validating Zip Code
I was recently putting together some proof of concept for a customer and realized that I hadn't posted one of the common Regular Expressions that I had been using.
Validating a Zip Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
' Invalid Zip code
'Dim strZip As String = "AB123"
' valid Zip Code
Dim strZip As String = "03110"
Dim regexp As New Regex(("^\d{5}$"))
If regexp.IsMatch(strZip) Then
MsgBox("Zip Code")
Else
MsgBox("No zip match")
End If
End Sub