Alpha-Numeric Characters
Test for alpha-numeric characters with this regexp.
//Alpha-numeric characters only "/^[a-zA-Z0-9]*$/"
Alpha-Numeric Characters With Spaces
Test for alpha-numeric characters and spaces with this regexp.
//Alpha-numeric characters with spaces only "/^[a-zA-Z0-9 ]*$/"
Alphabetic Characters
This regex will test for alphabetic characters only (upper and lowercase).
//Alphabetic characters only "/^[a-zA-Z]*$/"
Date (YYYY/MM/DD)
Validate the calendar date in YYYY/MM/DD format with this regex. Optional separators are spaces, hyphens, forward slashes, and periods. The year is limited between 1900 and 2099.
//Date (YYYY/MM/DD) "/^((19|20)?[0-9]{2}[- /.](0?[1-9]|1[012])[- /.](0?[1-9]|[12][0-9]|3[01]))*$/"
Digits
This regex will test for digits (whole numbers).
//Digits only "/^[0-9]*$/"
Emails
This email regex is not fully RFC5322-compliant, but it will validate most common email address formats correctly.
//Email regex "/^([a-zA-Z0-9._%-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4})*$/"
IP Addresses
Test IP Addresses with this regular expression.
//IP address regex "/^((?:(?: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]?))*$/"
URLs
This URL regex will validate most common URL formats correctly.
//URL regex "/^(((http|https|ftp):\/\/)?([[a-zA-Z0-9]\-\.])+(\.)([[a-zA-Z0-9]]){2,4}([[a-zA-Z0-9]\/+=%&_\.~?\-]*))*$/"