cheat_sheets_regex
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
cheat_sheets_regex [2022/09/25 14:01] – [Anchors] gman | cheat_sheets_regex [2023/02/11 14:34] (current) – [Groups and Ranges] gman | ||
---|---|---|---|
Line 5: | Line 5: | ||
[[https:// | [[https:// | ||
- | ---- | ||
===== Anchors ===== | ===== Anchors ===== | ||
- | + | ^ Syntax | |
- | ^ Syntax | + | |
| %%^%% | Start of string, or start of line in multi-line pattern | | | %%^%% | Start of string, or start of line in multi-line pattern | | ||
| $ | End of string, or end of line in multi-line pattern | | $ | End of string, or end of line in multi-line pattern | ||
Line 18: | Line 16: | ||
===== Quantifiers ===== | ===== Quantifiers ===== | ||
- | ^ Syntax ^ Description ^ | + | ^ Syntax |
- | | * | 0 or more | | + | | * |
- | | ? | 0 or 1 | | + | | ? |
- | | + | 1 or more | | + | | + |
- | | {3} | Exactly 3 | | + | | {3} |
- | | {3,} | 3 or more | + | | {3,} | 3 or more | |
- | | {3,5} |3, 4 or 5 | | + | | {3,5} |
- | | //note// | Add a ? to a quantifier to make it ungreedy | | + | | // |
---- | ---- | ||
- | | | + | ===== Escape ===== |
+ | |||
+ | ^ Syntax | ||
+ | | | ||
+ | |||
+ | **// | ||
+ | |||
+ | ---- | ||
+ | |||
+ | ===== Groups and Ranges ===== | ||
+ | |||
+ | ^ Syntax | ||
+ | | . | Any character except new line (\n) | | ||
+ | | (a%%|%%b) | ||
+ | | (...) | Group, capturing | ||
+ | | (?: | ||
+ | | [abc] | Range (a or b or c) | | ||
+ | | [%%^%%abc] | ||
+ | | [a-q] | Lower case letter from a to q | | ||
+ | | [A-Q] | Upper case letter from A to Q | | ||
+ | | [0-7] | Digit from 0 to 7 | | ||
+ | |||
+ | Use a group to " | ||
+ | * '' | ||
+ | * The parentheses are used to create " | ||
+ | * NOTE: in **gedit** you reference with a backslash: '' | ||
+ | * See the follow table regarding **string replacements**. | ||
+ | |||
+ | ---- | ||
+ | |||
+ | ===== String Replacement ===== | ||
+ | |||
+ | ^ Syntax | ||
+ | | $n | nth non-passive group | | ||
+ | | $2 | %%" | ||
+ | | $1 | %%" | ||
+ | | $` | Before matched string | ||
+ | | $' | ||
+ | | $+ | Last matched string | ||
+ | | $& | ||
+ | |||
+ | **Note:** Some regex implementations use \ instead of $. | ||
+ | |||
+ | ---- | ||
+ | |||
+ | ===== Character Classes ===== | ||
+ | |||
+ | ^ Syntax | ||
+ | | \c | Control character | | ||
+ | | \s | White space | | ||
+ | | \S | Not white space | | ||
+ | | \d | Digit | | ||
+ | | \D | Not digit | | ||
+ | | \w | Word | | ||
+ | | \W | Not word | | ||
+ | | \x | Hexadecimal digit | | ||
+ | | \O | Octal digit | | ||
+ | |||
+ | ---- | ||
+ | |||
+ | ===== POSIX ===== | ||
+ | |||
+ | ^ Syntax | ||
+ | | [: | ||
+ | | [: | ||
+ | | [: | ||
+ | | [: | ||
+ | | [: | ||
+ | | [: | ||
+ | | [: | ||
+ | | [: | ||
+ | | [: | ||
+ | | [: | ||
+ | | [: | ||
+ | | [: | ||
+ | | [: | ||
+ | |||
+ | ---- | ||
cheat_sheets_regex.1664114469.txt.gz · Last modified: by gman