Skip to content

Instantly share code, notes, and snippets.

@nasamuffin
Created April 26, 2019 01:02
Show Gist options
  • Save nasamuffin/8ac85faa388712e37898022346fdaf2e to your computer and use it in GitHub Desktop.
Save nasamuffin/8ac85faa388712e37898022346fdaf2e to your computer and use it in GitHub Desktop.
Cheatsheet for vim regex with \v specified.
Special matching strings
====
^ Start of line
$ End of line
. Any character
~ Match last given substitute string
[...] Match range
[^...] Not range
< Beginning of a word
> End of a word
_. Any single character OR EOL
Control strings
====
\ Escape next character
(...) Capture group
| Separate alternative
Replacement strings
====
& Insert entire matched pattern (equivalent to \0)
\n Insert capture group n
Quantifiers
====
* 0 or more quantifier
+ 1 or more quantifier
= 0 or 1 quantifier
? 0 or 1 quantifier
{n,m} n to m quantifier
{n} n quantifier
{n,} at least n quantifier
{,n} up to n quantifier
Lookaround
====
@<= positive lookbehind
@<! negative lookbehind
@= positive lookahead
@! negative lookahead
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment