Please note that these regex codes only work on SeamlessDocs. To obtain regex codes that apply to WebForms, please click here.
All Major Credit Cards
This regular expression will validate all major credit cards: American Express (Amex), Discover, Mastercard, and Visa.
/^4[0-9]{12}(?:[0-9]{3})?$|^3[47][0-9]{13}$|^6(?:011|5[0-9]{2})[0-9]{12}$|^(?:5[1-5][0-9]{2}|222[1-9]|22[3-9][0-9]|2[3-6][0-9]{2}|27[01][0-9]|2720)[0-9]{12}$/
Alpha-Numeric Characters without Spaces
Test for alpha-numeric characters with no spaces.
/^[a-zA-Z0-9]+$/
Alpha-Numeric Characters with Spaces
Test for alpha-numeric characters with no spaces.
/^[a-zA-Z0-9 ]+$/
Alphabetic Characters with Spaces
This regex will test for alphabetic characters only (upper and lowercase).
/^[a-zA-Z ]+$/
American Express Credit Card
Verify Amex credit cards. American Express card numbers start with 34 or 37 and have 15 digits.
/^3[47][0-9]{13}$/
Date (MM/DD/YYYY)
Validate the calendar date in MM/DD/YYYY format. The year is limited between 1900 and 2099.
/^((((0[13578])|([13578])|(1[02]))[\/](([1-9])|([0-2][0-9])|(3[01])))|(((0[469])|([469])|(11))[\/](([1-9])|([0-2][0-9])|(30)))|((2|02)[\/](([1-9])|([0-2][0-9]))))[\/]\d{4}$|^\d{4}$/
Date (MM-DD-YYYY)
Validate the calendar date in MM-DD-YYYY format. The year is limited between 1900 and 2099.
/^((((0[13578])|([13578])|(1[02]))-(([1-9])|([0-2][0-9])|(3[01])))|(((0[469])|([469])|(11))[\/](([1-9])|([0-2][0-9])|(30)))|((2|02)-(([1-9])|([0-2][0-9]))))-\d{4}$|^\d{4}$/
Digits
Only allow for digits with spaces.
/^[0-9 ]+$/
Emails
This email regex code is the RFC 5322 Official Standard.
/(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])/
IP Addresses
Test IP Addresses with this regular expression.
/\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b/
MasterCard Credit Card
Verify MasterCard credit card numbers. MasterCard numbers either start with the numbers 51 through 55 or with the numbers 2221 through 2720. All have 16 digits.
/^(?:5[1-5][0-9]{2}|222[1-9]|22[3-9][0-9]|2[3-6][0-9]{2}|27[01][0-9]|2720)[0-9]{12}$/
Phone Number (US)
Regex code to verify a 10-digit North American telephone number with parenthesis, space and dashes. (xxx) xxx-xxxx.
/^(\([0-9]{3}\) |[0-9]{3}-)[0-9]{3}-[0-9]{4}$/
Social Security Numbers
If you need to validate US Social Security Numbers, use this regular expression.
/^([0-9]{3}[-]*[0-9]{2}[-]*[0-9]{4})*$/
US ZIP Codes
This regex verifies US ZIP Codes, with an optional 4 number ZIP code extension.
/^\d{5}(-\d{4})?$/
Visa Credit Card
Verify Visa credit card numbers. All Visa card numbers start with a 4. New cards have 16 digits.
/^4[0-9]{12}(?:[0-9]{3})?$/
*Please note that Custom Regex Codes in SeamlessDocs must include “/” before and after code*
Regex Resources And Reference Sheets
There are a number of different regex cheat sheets, libraries, testers, and other resources around the web. Here are just a few of them.