| Pattern | Result |
|---|---|
| . | Matches any character except newline |
| [a-z0-9] | Matches any single character of set |
| [^a-z0-9] | Matches any single character not in set |
| \d | Matches a digit, same as [0-9] |
| \D | Matches a non-digit, same as [^0-9] |
| \w | Matches an alphanumeric (word) character [a-zA-Z0-9_] |
| \W | Matches a non-word character [^a-zA-Z0-9_] |
| \s | Matches a whitespace character (space, tab, newline...) |
| \S | Matches a non-whitespace character |
|   |   |
| \n | Matches a newline |
| \r | Matches a return |
| \t | Matches a tab |
| \f | Matches a formfeed |
| \b | Matches a backspace (inside [] only) |
| \0 | Matches a null character |
| \000 | Also matches a null character because ... |
| \nnn | Matches an ASCII character of that octal value |
| \xnn | Matches an ASCII character of that hexadicimal value |
| \cX | Matches an ASCII control character |
| \metachar | Matches the character itself (\|,\.,\*...) |
|   |   |
| (abc) | Rembers the match for later backreferences |
| \1 | Matches whatever the first set of parens matched |
| \2 | Matches whatever the second set of parens matched |
| \3 | and so on... |
|   |   |
| x? | Matches 0 or 1 x's, where x is any of the above |
| x* | Matches 0 or more x's |
| x+ | Matches 1 or more x's |
| x{m,n} | Matches at least m x's but nore more than n |
|   |   |
| abc | Matches all of a, b, and c in order |
| fee|fie|foe | Matches one of fee, fie, or foe |
|   |   |
| \b | Matches a word boundry (outside [ ] only) |
| \B | Matches a non-word boundry |
| ^ | Anchors match to the beginning of a line or string |
| $ | Anchors match to the end of a line or string |
