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
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…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.