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

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find State Codes
Expression
^(?-i:A[LKSZRAEP]|C[AOT]|D[EC]|F[LM]|G[AU]|HI|I[ADLN]|K[SY]|LA|M[ADEHINOPST]|N[CDEHJMVY]|O[HKR]|P[ARW]|RI|S[CD]|T[NX]|UT|V[AIT]|W[AIVY])$
Description
The RE match U.S. state abbreviation used by the U.S. Post Office.
Matches
AL | CA | AA
Non-Matches
New York | California | ny
Author Rating: The rating for this expression. Michael Ash
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: Re: Armed Forces Europe / Canada
Name: Michael Ash
Date: 5/27/2005 12:28:18 PM
Comment:
Thanks, It's Fixed.


Title: Armed Forces Europe / Canada
Name: Terry Johnson
Date: 5/26/2005 2:12:34 PM
Comment:
'AE' is missing from this regex.


Title: Re: Doesn't work with an ASP.NET Validater
Name: Michael Ash
Date: 3/29/2005 10:35:44 AM
Comment:
Jscript may not like the case insensitive modifier ?-i: Remove it and try again


Title: Doesn't work with an ASP.NET Validater
Name: Tome
Date: 3/25/2005 5:54:49 PM
Comment:
Doesn't seem to work with an ASP.NET validator


Title: re:US State RE needs correcting
Name: Michael Ash
Date: 5/13/2004 10:23:27 AM
Comment:
Thanks Mark


Title: US State RE needs correcting
Name: Mark
Date: 5/12/2004 11:03:42 PM
Comment:
This RE has a bug. It matches these texts when it should not: Blah Blah CA Blah ID Blah It should be corrected to: ^(A[LKSZRAP]|C[AOT]|D[EC]|F[LM]|G[AU]|HI|I[ADLN]|K[SY] |LA|M[ADEHINOPST]|N[CDEHJMVY]|O[HKR]|P[ARW]|RI|S[CD]| T[NX]|UT|V[AIT]|W[AIVY])$


Title: Software Developer
Name: Byron Saltysiak
Date: 1/3/2004 1:25:50 PM
Comment:
Very nice - verifies that you are dealing with a state very well.


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