From the course: Learning vi

Unlock the full course today

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

Regular expression examples

Regular expression examples - vi Tutorial

From the course: Learning vi

Start my 1-month free trial

Regular expression examples

I'm going to show you some examples of the regular expression meta-characters we've just discussed. We'll use our Purloined Letter file. If you search for just plain text, like the letters not, then it finds the not in Dunot. n shows another not. n shows another not, this one embedded in the word another. n, here's another not, embedded in the word notions. 1G to go to the back of the file. If you look for, n.t, which is an n followed by any character followed by a t, then, in this case it finds n space t. n, again, it finds n o t. n, n space t. n, n space t again. n, n space t again. n, not. n, n space t. n, n space t. n, not. n, not. n, n space t. n, nat, and so on. It'll find an n, followed by anything, followed by a t. 1G. You see near the middle of the screen the words, Number 33, capital N, little o, period, 33. If I search for capital N, o, period, it finds No period, n, but it also finds capital NOT. Remember that the period matches any character. n, it finds No question mark…

Contents