zaccone@shire.cs.psu.edu (10/29/89)
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? I am using version 18.54 of emacs. Rick Zaccone zaccone@bknlvms.bitnet zaccone@sol.bucknell.edu
moore%cdr.utah.edu@cs.utah.edu (Tim Moore) (10/31/89)
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