Path: utzoo!telly!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!agate!helios.ee.lbl.gov!hellgate.utah.edu!cdr.utah.edu!moore From: moore%cdr.utah.edu@cs.utah.edu (Tim Moore) Newsgroups: gnu.emacs Subject: Re: Problem with replace-regexp? Message-ID: <1989Oct30.111936.21647@hellgate.utah.edu> Date: 30 Oct 89 18:19:35 GMT References: <1989Oct28.200348.7058@psuvax1.cs.psu.edu> Organization: University of Utah CS Dept Lines: 25 In article <1989Oct28.200348.7058@psuvax1.cs.psu.edu> zaccone@shire.cs.psu.edu writes: >I have been trying to use replace-regexp to eliminate the first >character in every line of a file. If I try replacing "^." with "", >everything in the file gets deleted! Shouldn't this work? Is this a >bug, or am I missing something obvious? The problem is that emacs doesn't skip to the next line after a regexp match and replacement (like sed, for example). After the first character on the line is matched and deleted, the next character matches the regexp and is deleted, etc. Try replacing "^.\(.*\)$" with "\1" if you are doing this interactively, or (replace-regexp "^.\\(.*\\)$" "\\1") if you are calling replace-regexp from emacs lisp code. >Rick Zaccone >zaccone@bknlvms.bitnet >zaccone@sol.bucknell.edu Tim Moore moore@cs.utah.edu {bellcore,hplabs}!utah-cs!moore "Ah, youth. Ah, statute of limitations." -John Waters