JavaScript Zip Code Validation

A 5-digit United States Zip Code can be validated in JavaScript with a regular expression:
/^\d{5}$/.test('84601')
This specifies that the string being tested must begin and end as a digit with a length of five.

JavaScript Email Address Validation

Email addresses can be validated in JavaScript by using a regular expression:
(The following regular expression is actually one line – I have broken it into two so that it will wrap properly in WordPress.)
/^[A-Za-z0-9]+\w*([._-][a-zA-Z0-9]+)*@[A-Za-z0-9]+([._-][a-zA-Z0-9]+)*
\.[a-zA-Z]{2,}$/.test('joey@joey.com') ;
The JavaScript email address validation demonstrated here is somewhat loose to allow for varying email possibilities.
Broken down into sections:
^[A-Za-z0-9]+ – Begin [...]

JavaScript Regular Expression Square Bracket Negation

In JavaScript Regular Expressions the caret (^) can be used in square brackets as a negation character.
/[^abc]/ – would match for any characters that are not a, b or c.
/[^hb]at/ – would match for cat but not for hat or bat.