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 3
Title Test Details Street Number only
Expression
((\d{1,6}\-\d{1,6})|(\d{1,6}\\\d{1,6})|(\d{1,6})(\/)(\d{1,6})|(\w{1}\-?\d{1,6})|(\w{1}\s\d{1,6})|((P\.?O\.?\s)((BOX)|(Box))(\s\d{1,6}))|((([R]{2})|([H][C]))(\s\d{1,6}\s)((BOX)|(Box))(\s\d{1,6}))?)$
Description
This is my first attempt at creating a regex. For a street number only field, allows 7 digit number, 6 digit number with one preceding letter (the letter can have a hyphen, space, or nothing between it and the numbers), two 7 digit numbers divided by a "/","\", or "-", variations of P.O. Box we allow, Rural Route, and Highway Contract acoording to U.S. Postal rules.
Matches
4444, G 4444, 333/555, P.O. Box 432, RR 4 Box 567
Non-Matches
po box 432, GG4321, 48392021
Author Rating: Not yet rated. Michael Dallaire
Title Test Details Positive number greater than
Expression
((?!^[0-4])^(\d+))$
Description
Allows only a positive whole number greater than 4. Obviously it can be easily changed to be greater than any number desired.
Matches
5,10,100,9999999
Non-Matches
-2,0,4.2,6.5
Author Rating: Not yet rated. Michael Dallaire
Title Test Details U.S. social security number
Expression
(\d{3}\-\d{2}\-\d{4})
Description
pattern match for U.S. social security number
Matches
111-22-3333
Non-Matches
11-222-3333, 1111-22-333
Author Rating: Not yet rated. Michael Dallaire
   Displaying page 1 of 1 pages; Items 1 to 3

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