diff options
| author | srdusr <[email protected]> | 2023-01-28 15:53:37 +0200 |
|---|---|---|
| committer | srdusr <[email protected]> | 2023-01-28 15:53:37 +0200 |
| commit | 64b3b8f2a46af779c9b009d893ee5d0e0cf7bfb8 (patch) | |
| tree | 93bed62a766012f385043c0543e16b0ea9b2e88b /tools/vim.md | |
| parent | 16b12726145839a872f5ac509b62b82198dcd84b (diff) | |
| download | notes-64b3b8f2a46af779c9b009d893ee5d0e0cf7bfb8.tar.gz notes-64b3b8f2a46af779c9b009d893ee5d0e0cf7bfb8.zip | |
Add vim regex section
Diffstat (limited to 'tools/vim.md')
| -rw-r--r-- | tools/vim.md | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/tools/vim.md b/tools/vim.md index 108d743..ceb6828 100644 --- a/tools/vim.md +++ b/tools/vim.md @@ -309,6 +309,37 @@ The `:substitute` command searches for a text pattern, and replaces it with a te \: `%s/foo/bar/gcI` - - - +#### Regex (Regular Expressions) aka regexp +* Range of operation, line Addressing and Marks + +Specifier number | Description +---|--- +number | an absolute line number +. | the current line +$ | the last line in the file +% | the whole file. The same as 1,$ +'t | position of mark "t" +/pattern[/] | the next line where text "pattern" matches. +?pattern[?] | the previous line where text "pattern" matches +\ \/ | the next line where the previously used search pattern matches +\ \? | the previous line where the previously used search pattern matches +\ \& | the next line where the previously used substitute pattern matches + +* Quantifiers, Greedy and Non-Greedy + +Quantifier | Description +---|--- +\* | matches 0 or more of the preceding characters, ranges or metacharacters .* matches everything including empty line +\ \+ | matches 1 or more of the preceding characters... +\ \= | matches 0 or 1 more of the preceding characters... +\ \{n,m} | matches from n to m of the preceding characters... +\ \{n} | matches exactly n times of the preceding characters... +\ \{,m} | matches at most m (from 0 to m) of the preceding characters... +\ \{n,} | matches at least n of of the preceding characters... +| | where n and m are positive integers (>0) + +- - - + * Permission override ``` :w !sudo tee % - Allows to override the permission of the written file |