Article View: comp.emacs
Article #3290Re: strange replace-regexp behavior
From: Richard Levitte
Date: Mon, 28 Dec 1992 18:15
Date: Mon, 28 Dec 1992 18:15
51 lines
1914 bytes
1914 bytes
Hmm... I tried to reply by mail, but it bounced.
>>>>> On 28 Dec 92 13:39:23 GMT, pat@gsfc.nasa.gov (patrick m. ryan) said:
[...]
>In article 999, joe@blow said:
>>blah blah blah
>> blah blah blah
pmr> I wanted to remove the first '>' in each line. Thus, I did:
pmr> (replace-regexp "^>" "")
[...]
=>
pmr> In article 999, joe@blow said:
pmr> blah blah blah
pmr> blah blah blah
I think this is what is happening (^ is the point after each operation):
Match: >In article 999, joe@blow said:
^
Repl: In article 999, joe@blow said:
^
...
Match: >>blah blah blah
^
Repl: >blah blah blah
^
Match: >blah blah blah
^
Repl: blah blah blah
^
... and the same for the last line.
Instead, try:
(replace-regexp "^>\\(.*$\\)" "\\1")
--
!+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++!
! Richard Levitte, VMS GNU Emacs hacker ! tel: int+46-8-18 30 99 !
! Sulv"agen 57, II ! fax: none for the moment !
! S-126 40 H"agersten ! Internet: levitte@e.kth.se !
! SWEDEN ! !
!-----------------------------------------------------------------------------!
Technical Details
Message-ID:
<LEVITTE.92Dec28191527@elmer.e.kth.se>Path:
arc1-ca.pugleaf.net!sparky!uunet!think.com!enterpoop.mit.edu!eru.mt.luth.se!kth.se!news.kth.se!LEVITTEReferences:
<1992Dec28.133923.27974@nsisrv.gsfc.nasa.gov>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!think.com!enterpoop.mit.edu!eru.mt.luth.se!kth.se!news.kth.se!LEVITTE From: LEVITTE@e.kth.se (Richard Levitte) Newsgroups: comp.emacs,gnu.emacs.help,gnu.epoch.misc Subject: Re: strange replace-regexp behavior Message-ID: <LEVITTE.92Dec28191527@elmer.e.kth.se> Date: 28 Dec 92 18:15:27 GMT References: <1992Dec28.133923.27974@nsisrv.gsfc.nasa.gov> Sender: usenet@kth.se (Usenet) Organization: Department of TeleTransmission Theory Lines: 51 In-Reply-To: pat@gsfc.nasa.gov's message of 28 Dec 92 13:39:23 GMT Nntp-Posting-Host: elmer.e.kth.se