12 Basic cheatsheets for regular expression
20 | Pattern | Description |
21 | -------- | ------------------------------------ |
22 | `.` | Any character, except newline |
28 | `\S` | Not whitespace |
29 | `[abc]` | Any of a, b, or c |
30 | `[a-e]` | Characters between `a` and `e` |
31 | `[1-9]` | Digit between `1` and `9` |
32 | `[^abc]` | Any character except `a`, `b` or `c` |
36 | Pattern | Description |
37 | ------- | ----------------------- |
38 | `\G` | Start of match |
39 | `^` | Start of string |
40 | `$` | End of string |
41 | `\A` | Start of string |
42 | `\Z` | End of string |
43 | `\z` | Absolute end of string |
44 | `\b` | A word boundry |
45 | `\B` | Non-word boundry |
46 | `^abc` | Start with `abc` |
47 | `abc$` | End with `abc` |
49 ### Escaped characters
51 | Pattern | Description |
52 | ---------- | -------------------------------------- |
53 | `\. \* \\` | Escape special character used by regex |
56 | `\r` | Carriage return |
60 | Pattern | Description |
61 | --------- | ------------------------------ |
62 | `(abc)` | Capture group |
63 | `(a|b)` | Match `a` or `b` |
64 | `(?:abc)` | Match `abc`, but don't capture |
69 | Pattern | Description |
70 | -------- | --------------------- |
71 | `a*` | Match 0 or more |
72 | `a+` | Match 1 or more |
73 | `a?` | Match 0 or 1 |
74 | `a{5}` | Match exactly 5 |
75 | `a{,3}` | Match up to 3 |
76 | `a{3,}` | Match 3 or more |
77 | `a{1,3}` | Match between 1 and 3 |