Regular Expression to Match Zip Code
Imports System.Text.RegularExpressions
Function IsValidZip(ByVal sZipCode As String)
Return Regex.IsMatch(sZipCode, "^\d{5}(\-\d{4})?$")
End Function
The above will check for U.S . Zip codes like 55001-2434. 94941-3232 etc
To Check Indian Zip codes use
Imports System.Text.RegularExpressions
Function IsValidZip(ByVal sZipCode As String)
Return Regex.IsMatch(sZipCode, "^\d{6}$")
End Function
Matches 600040, 400123 etc
No comments:
Post a Comment