Regular Expression Cheat Sheet
The following are some of the most commonly used metacharacters and a very short description of their effect;
[ ] |
Match anything inside the square brackets for ONE character |
^ |
(circumflex or caret) Matches only at the beginning of the target string (when not used inside square brackets (where it has a different meaning)) |
$ |
Matches only at the end of the target string |
. |
(period or full-stop) Matches any single character |
? |
Matches when the preceding character occurs 0 or 1 times only |
* |
Matches when the preceding character occurs 0 or more times |
+ |
Matches when the preceding character occurs 1 or more times |
( ) |
Can be used to group parts of our search expression together |
| |
(vertical bar or pipe) Allows us to find the left hand or right values |