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 US ZipCode
Expression
(^(?!0{5})(\d{5})(?!-?0{4})(|-\d{4})?$)
Description
This expression matches two different formats of zip codes: 5 digit US ZIP code and 5 digit US ZIP code + 4.The first one must be 5 numeric digits. The ZIP+4 must be 5 numeric digits, a hyphen, and then 4 numeric digits.
Matches
12345 | 12345-1234
Non-Matches
00000 | 123451234 | 12345-0000 | 00000-0000 | 00000-1234 | 000001234
Author Rating: The rating for this expression. megha patel
   Displaying page 1 of 1 pages; Items 1 to 1

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