Windows Phone Developers

Sunday, May 6, 2012

Regular Expression to Check Zip Code

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
Digg Technorati Delicious StumbleUpon Reddit BlinkList Furl Mixx Facebook Google Bookmark Yahoo
ma.gnolia squidoo newsvine live netscape tailrank mister-wong blogmarks slashdot spurl StumbleUpon

No comments:

Post a Comment

kbAlertz.com :: Visual Studio 2005

kbAlertz.com :: Visual Studio 2008

kbAlertz.com :: Visual Basic 2005