| Flags |
| i | make the pattern case insensitive |
| g | search for every occurence of the matching pattern |
| Position Characters |
| ^ | pattern must be at the start of the text string |
| $ | pattern must be at the end of the text string |
| \b | match a position that is a word boundary (the point between a word character and
a non-word character |
| \B | match a position that is not a word boundary |
| Character Classes |
| \d | match any digit 0-9 |
| \D | match any character that is not a digit |
| \w | match any word character (0-9, A-Z, a-z, or _ ) |
| \W | match any non-word character |
| \s | match any whitespace character (space, tab, newline, carriage return, form feed) |
| \S | match any non-whitespace character |
| . | match any character |
| Character Classes |
| [chars] | match any characters (chars) within the brackets |
| [^chars] | match any character except those within the brackets (chars)
|
| [char1-charN] | match characters in the range char1 through charN |
| [^char1-charN] | do not match characters in the range char1 through charN |
| Repetition Characters |
| * | repeat zero or more times |
| ? | repeat zero or one time |
| + | repeat one or more times |
| {n} | repeat exactly n times |
| {n, } | repeat at least n times |
| {n,m} | repeat at least n times, but no more than m times |
| Escape Sequences |
| \/ | match a / |
| \\ | match a \ |
| \. | match a . |
| \* | match a * |
| \+ | match a + |
| \? | match a ? |
| \| | match a | |
| \( | match a ( |
| \) | match a ) |
| \{ | match a { |
| \} | match a } |
| \^ | match a ^ |
| \$ | match a $ |
| \n | match a new line |
| \r | match a carriage return |
| \t | match a tab |
| Alternative and Grouping Characters |
| chars1|chars2 | match either the chars1 or chars2 character patterns |
| (chars) | group the character pattern char and treat it as a single unit. Matched groups are captured and available for later procession as back-reference |
| \n | the back-reference to group n |
| (?chars) | group the character pattern char and treat it as a single unit. Matched groups are not back-referenced |