Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!wuarchive!psuvax1!psuvm!blekul11!ffaac09 From: FFAAC09@cc1.kuleuven.ac.be (Nicole Delbecque & Paul Bijnens) Newsgroups: comp.editors Subject: Re: Regular Expression (vi type) question... Message-ID: <91088.120845FFAAC09@cc1.kuleuven.ac.be> Date: 29 Mar 91 12:07:45 GMT References: <1991Mar28.191204.12295@cbnewsl.att.com> Distribution: na Organization: K.U.Leuven - Academic Computing Center Lines: 36 In article <1991Mar28.191204.12295@cbnewsl.att.com>, sgilley@cbnewsl.att.com (The Idealistic Cynic) says: > >Can a single regular expression be used to delete >all characters including and after the last "." in a line? > >Input might be: > >test >stay.c >junk.1.c > >And I need the output to be: > >test >stay >junk.1 > >I've played with this a while, and can't seem to come >up with an answer that will work. (It's easy if you >assume all lines will have at least one "." in them.. >what I can't get is if they don't.) No need to assume there is a dot: :%s/\.[^.]*$// in english: on all lines, substitute a literal dot, followed by anything but a dot, only at the end of a line, by nothing. The substitution happens only on the lines that match. Works with me (SYSV3.2 vi version 3.9 2/9/83). -- Polleke (Paul Bijnens) Linguistics dept., K. University Leuven, Belgium FFAAC09@cc1.kuleuven.ac.be