JavaScript Regular Expression Square Brackets

Square brackets are used in JavaScript Regular Expressions to create a character class. Character classes are based on a grouping of literal characters. For example, /[joey]/ would evaluate to true if any of the literal characters ‘j’, ‘o’, ‘e’ or ‘y’ is found in the test string:
//The following evaluates to true because it contains a [...]