Regex examples

Type Regular Expression Matches
Character String ^[a-zA-Z]+$ Any string of characters without numeric values.
Dollar Amount ^(\$)?(([1-9]\d{0,2}(\,\d{3})*)|([1-9]\d*)|(0))(\.\d{2})$ A dollar amount with 2 decimal places and with or without a dollar sign and comma.
Email ^((?:(?:(?:\w[\.\-\+]?)*)\w)+)\@((?:(?:(?:\w[\.\-\+]?){0,62})\w)+)\.(\w{2,6})$ Any valid email address except ones with IP addresses.
Long Date ^\d{1,2}\/\d{1,2}\/\d{4}$ Dates in the form of MM/DD/YYYY where the month can be 1 or 2 digits long and the year is 4 digits.
Numeric String ^[-+]?\d*$ Any string with numeric values only.
Phone Number ((\(\d{3}\) ?)|(\d{3}-))?\d{3}-\d{4} A US phone number that is hyphen separated with or without parenthesis for the area code.
Short Date ^\d{1,2}\/\d{1,2}\/\d{2}$ Dates in the form of MM/DD/YY where the month can be 1 or 2 digits long and the year is 2 digits.
SSN \d{3}-\d{2}-\d{4} A hyphen-separated social security number (SSN) in the format XXX-XX-XXXX.
Zip Code \d{5}(-\d{4})? Any 5 numeric digit zip code or a zip code with 5 numeric digits followed by a hyphen with 4 numeric digits.