Each character (be it a literal or a special character) or a range of characters is followed by a quantifier, or a multi in Vim terms.
For example, w+ will match one or more word characters, and a{2,4} will match two to four a characters in succession (such as aaa, for example).
Here is the list of most common quantifiers:
Symbol |
Meaning |
* |
0 or more, greedy |
+ |
1 or more, greedy |
{-} |
0 or more, non-greedy |
? or = |
0 or 1, greedy |
{n,m} |
n to m, greedy |
{-n,m} |
n to m, non-greedy |
You may have encountered two new terms in the table given: greedy and non-greedy. Greedy search refers to trying to match as many characters as possible, while non-greedy search tries to match as few characters as possible.
For example, given a string foo2bar2, greedy regex w+2 will match foo2bar2 (as many characters as it can until encountering a final 2), while non-greedy w{-1,}2 will only match foo2.