RegExLib.com - The first Regular Expression Library on the Web!

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find Pattern Title
Expression
^(?(^00000(|-0000))|(\d{5}(|-\d{4})))$
Description
US zip code expression that disallows 00000 or 00000-0000 for either ZIP or ZIP+4. Great for web site validation.
Matches
12345 | 12345-6789
Non-Matches
00000 | 00000-0000 | a4650-465s
Author Rating: Not yet rated. Paul Duncan
Source
Your Rating
Bad Good

Enter New Comment

Title
 
Name
 
Comment
 
Spammers suck - we apologize. Please enter the text shown below to enable your comment (not case sensitive - try as many times as you need to if the first ones are too hard):

Existing User Comments

Title: Syntax error
Name: Jimmy
Date: 2/2/2004 4:25:53 PM
Comment:
This expression does not work for javascript. It gives a syntax error. Test using javascript on this site to see the error.


Title: Error
Name: Ramakoteswara Rao Atluri
Date: 12/17/2003 5:05:34 AM
Comment:
When i use this in my VBSCRIPT page, I am getting the Syntax error.So could you please give me the correct one for blocking the 00000 in US ZIP code.


Title: ok...
Name: Paul Duncan
Date: 12/15/2003 9:39:11 AM
Comment:
Please explain. I'm not sure how a regular expression is giving a client side error for .aspx specifically. Would you mind providing the error message and what it would take to re-create it? Thank you.


Title: Gives syntax error
Name: Kulanthaivel
Date: 12/15/2003 7:38:26 AM
Comment:
gives a client side error when used in .aspx page


Copyright © 2001-2018, RegexAdvice.com | ASP.NET Tutorials