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

Please support RegExLib Sponsors

Sponsors

Expressions by User

   Displaying page 1 of 1 pages; Items 1 to 1
Title Test Details U.S. Zip Code
Expression
(\d{5})[\.\-\+ ]?(\d{4})?
Description
Matches any 5 or 9 digit U.S. zip code with a period, hyphen, plus sign, space delimiter or no delimiter. The first capture is the first 5 digits and, optionally, the second capture is the last 4 digits. Add ^ at the beginning and $ to force the entire string to be a valid zip.
Matches
03576 | 12345-1234 | 123456789 | 03576 1234
Non-Matches
abcde | 03576-abcd | 3211
Author Rating: Not yet rated. TJB
   Displaying page 1 of 1 pages; Items 1 to 1

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