课程: Learning vi

今天就学习课程吧!

今天就开通帐号,24,700 门业界名师课程任您挑!

Regular expression examples

Regular expression examples - vi教程

课程: Learning vi

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…

内容