Path: utzoo!attcan!uunet!husc6!ukma!uflorida!novavax!potpourri!bseymour From: bseymour@potpourri.UUCP (Burch Seymour) Newsgroups: comp.unix.questions Subject: VI - Bug or feature????? Keywords: regular expression, search, help Message-ID: <1244@potpourri.UUCP> Date: 18 Jul 88 18:52:37 GMT Organization: Gould CSD, Fort Lauderdale, FL Lines: 23 I noticed the following strange behavior of vi and, while it's not exactly a critical problem, I am curious as to whether vi is flawed, or my understanding of the way vi does searches is flawed. Consider the following three lines of text: loog loog loog loog loog loog loog loog loog loog loog loog loog loog loog loog loog loog Now search for loog using '/loog' followed by 'n' as required. Vi will stop the cursor on each word in the three lines. Fine so far. Now search using '/l.*g' and 'n'. Vi will stop at the first position of each line. This, or so I am told, is because vi matches the longest possible pattern, and the whole line matches, so the next match is on the next line. Fair enough. Now the buggy part. Position the cursor on some character other than the first one on any of those lines. Then do the '/l.*g'. I would expect it to stop at the next occurance of 'l' on that line. It does not. It will stop at the first position of the next line. Anyone care to speculate why? And is that a correct thing for it to do? -Burch Seymour- ...uunet!gould!bseymour or whatever else you can conjure up ----------------------------------------