From the course: Learning vi

Unlock the full course today

Join today to access over 22,400 courses taught by industry experts or purchase this course individually.

A brief introduction to regular expressions

A brief introduction to regular expressions - vi Tutorial

From the course: Learning vi

Start my 1-month free trial

A brief introduction to regular expressions

When you perform a search in vi, your search text is interpreted as a regular expression, which is a special kind of string containing meta-characters that stand for things other than themselves. One meta-character is the period, which matches any single character. For example, if you search for a.c, it matches abc, axc or a space c or even a.c. It'll match and a and a c with any single character in between them, but that period stands for exactly one single character, so a search for a dot c does not match ac. Another important meta-character is the backslash. The backslash character removes the special meaning of the following character. If you want to search for an actual period, you have to say backslash period. So a\.c matches a.c and not a x c or a r c. The backslash also removes its own special meaning. So you have to say a\\c if you want to look for a\c. The backslash also removes the special meaning of the slash character itself. Usually if you type another slash in the…

Contents