Skip to Content
Mastering Vim
book

Mastering Vim

by Ruslan Osipov
November 2018
Beginner
330 pages
7h 21m
English
Packt Publishing
Content preview from Mastering Vim

Quantifiers or multis

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

The full list of quantifiers is available through :help multi.

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 ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Mastering Vim

Mastering Vim

Damian Conway
Vim Masterclass

Vim Masterclass

Jason Cannon
Modern Vim

Modern Vim

Drew Neil

Publisher Resources

ISBN: 9781789341096Supplemental Content