Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!lll-winken!uunet!wucs1!wugate!wupost!kuhub.cc.ukans.edu!huxtable From: huxtable@kuhub.cc.ukans.edu (Kathryn Huxtable) Newsgroups: gnu.emacs.bug Subject: Re: replace-regexp Message-ID: <5211@kuhub.cc.ukans.edu> Date: 15 Apr 89 18:52:46 GMT References: <8904130343.AA05725@starbase> Distribution: gnu Organization: University of Kansas Academic Computing Services Lines: 31 In article <8904130343.AA05725@starbase>, israel@STARBASE.MITRE.ORG (Bruce Israel) writes: > From: mailrus!sharkey!itivax!umich!zip!spencer@purdue.edu (Spencer W. Thomas) > > In some article loic%axis_d@axis.axis.fr writes: > > > (replace-regexp "^." "" ()) > > It empties my buffer ! > > It should skip to the next new-line. Don't you think so ? > > Well, no. Emacs is a character-oriented editor, NOT a line-oriented > editor. Would you want it to skip to the next line after each > replacement if the strings were (say) "abc" and ""? > > No, it shouldn't skip to the next line, but it SHOULD skip past the > previously matched string. [stuff deleted] A replacement > should not be re-run on the results of the replacement. Effectively, a > replace- should look like it found all non-overlapping occurences > of the search item first, and then did the change second. For a similar > example, should the null op (replace-string "a" "a") be an infinite loop? > > I think that the workarounds given for this problem are excessively > complicated for the task the guy is trying to perform. I hate beating a dead fish, but regular expressions are dear to my heart. I agree completely. "Natural" regular expressions should replace the natural thing. The workarounds were convoluted. I know that "natural" is sometimes hard to pin down, but I don't think this is such a case. -Kathryn Huxtable huxtable@kuhub.cc.ukans.edu