Regex cheatsheet

SYMBOL DESCRIPTION
/regex/ A regex is normally enclosed between two forward slashes.
/regex/i A case insensitive search.
/regex/g A global search.
. Represents any single character.
? The preceding character may or may not be present.
+ One or more copies of the preceding character.
* Zero or more copies of the preceding character.
{} An integer n enclosed in curly brackets means we want n copies of the preceding character.
| The boolean or operator.
() The inside of these brackets is evaluated as a group.
[] Alternative boolean or operator for each element in the brackets.
[-] Represents a range of characters or integers.
[^-] Represents all characters not in a range.
\ Escape character, allows special characters to be read without their special meaning when placed immediately in front of them. Common characters required to be escaped are: ., ?, +, *, {, }, |, (, ), [, ], -, ^, \ and $.