Creating a Regular Expression<!– –>  

var checkPattern = new RegExp(“\\d{2}/\\d{2}\\d{4}“);

Working With Regular Expressions<!– –> 

Method<!– –>

<!– –>Description<!– –>

<!– –>exec <!– –> <!– –>A RegExp method that executes a search for a match in a string. It returns an array of information. <!– –> 
<!– –>test <!– –> <!– –>A RegExp method that tests for a match in a string. It returns true or false. <!– –> 
<!– –>match <!– –> <!– –>A String method that executes a search for a match in a string. It returns an array of information or null on a mismatch. <!– –> 
<!– –>search <!– –> <!– –>A String method that tests for a match in a string. It returns the index of the match, or -1 if the search fails. <!– –> 
<!– –>replace <!– –> <!– –>A String method that executes a search for a match in a string, and replaces the matched substring with a replacement substring. <!– –> 
<!– –>split <!– –> <!– –>A String method that uses a regular expression or a fixed string to break a string into an array of substrings. <!– –> 

Common expressions

Date    /^d{1,2}(-|/|.)d{1,2}1d{4}$/     mm/dd/yyyy
US zip code   /(^d{5}$)|(^d{5}-d{4}$)/             99999 or 99999-9999
Canadian postal code   /^D{1}d{1}D{1}-?d{1}D{1}d{1}$/   Z5Z-5Z5 orZ5Z5Z5
Time   /^([1-9]|1[0-2]):[0-5]d(:[0-5]d(.d{1,3})?)?$/   HH:MM or HH:MM:SS or HH:MM:SS.mmm
IP Address(no check for alid values (0-255))   /^d{1,3}.d{1,3}.d{1,3}.d{1,3}$/ 999.999.999.999
Dollar Amount   /^(($d*)|($d*.d{2})|(d*)|(d*.d{2}))$/ 100, 100.00, $100 or $100.00
Social Security Number   /^d{3}-?d{2}-?d{4}$/   999-99-9999 or999999999
Canadian Social Insurance Number   /^d{9}$/ 999999999
----------------------------------------------------------------------------