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 6
Title Test Details Pattern Title
Expression
^\d{5}((-|\s)?\d{4})?$
Description
Single field zip code validator, useful for Web Forms. Allows user to enter 5-digit or 5-digit plus 4 zip code, with hyphen or space or NO space between last 4 digits.
Matches
92078-4705 | 920784705 | 92078 4705
Non-Matches
9027x | 902 | 92078.4705
Author Rating: The rating for this expression. MARK J KRISBURG
Title Test Details Pattern Title
Expression
^\d{5}((\-|\s)?\d{4})?$
Description
Single field zip code validator useful for web forms, where user may enter 5 digit or 9 digit zip code, and may use hyphen, space, or no space between the first 5 digits and last 4 digits.
Matches
92078 | 92078-4705 | 92078 4705
Non-Matches
920781 | 920a87 | 920
Author Rating: Not yet rated. MARK J KRISBURG
Title Test Details Pattern Title
Expression
^(\([2-9]|[2-9])(\d{2}|\d{2}\))(-|.|\s)?\d{3}(-|.|\s)?\d{4}$
Description
Telephone validator allowing user to enter 10 digit telephone number with segments of number separated by hyphens, periods or spaces. Also braces allowed around area code.
Matches
213-123-1234 | 2131231234 | (213) 123-1234
Non-Matches
123-123-1234
Author Rating: The rating for this expression. MARK J KRISBURG
Title Test Details Pattern Title
Expression
^\(?(?<AreaCode>[2-9]\d{2})(\)?)(-|.|\s)?(?<Prefix>[1-9]\d{2})(-|.|\s)?(?<Suffix>\d{4})$
Description
US telephone number with area code. Validates and also captures AreaCode, Prefix and Suffix for reformatting.
Matches
(213) 343-1234 | 213-343-1234 | 213 343 1234
Non-Matches
343-1234
Author Rating: Not yet rated. MARK J KRISBURG
Title Test Details Pattern Title
Expression
(?<zip5>^\d{5})([\- ]?(?<plus4>\d{4})?$)
Description
Zip Code (Zip or Zip-Plus4 format). Accepts a hyphen, a space, or nothing between Zip and Plus4 segments. Named segments &lt;zip&gt; and &lt;plus4&gt; may be used to reformat users input to desired format using Regex replace function (re.replace).
Matches
92078 | 92078-4705 | 92078-4705
Non-Matches
9207 | 92078470 | 92078*4705
Author Rating: Not yet rated. MARK J KRISBURG
   Displaying page 1 of 1 pages; Items 1 to 6

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