Extended Regular Expressions

We introduced extended regular expressions earlier in the section Extended Regular Expressions. The additional metacharacters available in elvis are:

\|

Indicates alternation.

\(...\)

Used for grouping, to allow the application of additional regular expression operators.

\+

Matches one or more of the preceding regular expressions.

\?

Matches zero or one of the preceding regular expressions.

\@

Matches the word under the cursor.

\=

Indicates where to put the cursor when the text is matched. For instance, hel\=lo would put the cursor on the second l in the next occurrence of hello.

\{...\}

Describes an interval expression, such as x\{1,3\} to match x, xx, or xxx.

POSIX bracket expressions (character classes, etc.) are available.

Get Learning the vi and Vim Editors, 7th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.