💾 Archived View for tilde.club › ~filip › tech › cheatsheet › regex.gmi captured on 2024-06-16 at 12:50:05. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2022-07-16)

-=-=-=-=-=-=-

regex

Anchors

+--------------------------+
| ^  | beginning of line   |
| $  | end of line         |
| \A | beginning of string |
| \Z | end of string       |
| \< | beginning of word   |
| \> | end of word         |
| \b | word boundary       |
| \B | not word boundary   |
+--------------------------+

Groups and ranges

+-----------------------------------+
|.      | any character             |
|(a|b)  | character "a" or "b"      |
|(...)  | group                     |
|[abc]  | range ("a" or "b" or "c") |
|[^abc] | not ("a" or "b" or "c")   |
+-----------------------------------+

Special characters

+----------------------+
| \n | new line        |
| \t | tab             |
| \r | carriage return |
+----------------------+

Character classes

+-----------------------------------+
| \c | control character            |
| \s | any whitespace character     |
| \S | any non-whitespace character |
+-----------------------------------+