SMOLNET PORTAL home about changes

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 |
+-----------------------------------+
Response: 20 (Success), text/gemini
Original URLgemini://tilde.club/~filip/tech/cheatsheet/regex.gmi
Status Code20 (Success)
Content-Typetext/gemini; charset=utf-8; lang=en