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

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find US ZIP (5 or 5+4)
Expression
^\d{5}$|^\d{5}-\d{4}$
Description
This regular expression will match either a 5 digit ZIP code or a ZIP+4 code formatted as 5 digits, a hyphen, and another 4 digits. Other than that, this is just a really really long description of a regular expression that I'm using to test how my front page will look in the case where very long expression descriptions are used.
Matches
55555-5555 | 34564-3342 | 90210
Non-Matches
434454444 | 645-32-2345 | abc
Author Rating: The rating for this expression. Steven Smith
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: an other (shorter) way to write it
Name: Pascal Courtonne
Date: 12/11/2006 11:07:54 AM
Comment:
^\d{5}(-\d{4})?$


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