💾 Archived View for tilde.club › ~filip › tech › cheatsheet › regex.gmi captured on 2023-05-24 at 18:04:13. 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 |
+-----------------------------------+