[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: A variant of match-end, but after replacement?
From: |
Marcin Borkowski |
Subject: |
Re: A variant of match-end, but after replacement? |
Date: |
Sun, 19 Jul 2015 15:20:57 +0200 |
On 2015-07-19, at 14:30, Pascal J. Bourguignon <pjb@informatimago.com> wrote:
> Marcin Borkowski <mbork@mbork.pl> writes:
>
>> On 2015-07-19, at 14:06, Pascal J. Bourguignon <pjb@informatimago.com> wrote:
>>
>>> Marcin Borkowski <mbork@mbork.pl> writes:
>>>
>>>> Hi all,
>>>>
>>>> I perform search using string-match, and then do the replacement using
>>>> replace-match. Now I'd like to know the position of the end of my
>>>> replacement, so that I know where to start the next search (since I'm
>>>> coding a variant of replace-regexp-in-string). Is there anything like
>>>> that in Emacs, or should I just concatenate the parts before and after
>>>> the match with the match in-between instead of using replace-match, so
>>>> that I can calculate that position myself?
>>>
>>> (let ((old-end (prog1 (match-end 1)
>>> (replace-match "newtext" t t nil 1))))
>>> (do-something old-end))
>>
>> Nope - I'm doing search and replacement in a string, not in a buffer...
>>
>> Thanks anyway
>
> Then:
>
> (let ((old-end (prog1 (match-end 1)
> (replace-match "newtext" t t string 1))))
> (do-something old-end))
Still not there - I can't assume that "newtext" will have the same
length as the thing it replaced...
--
Marcin Borkowski
http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski
Faculty of Mathematics and Computer Science
Adam Mickiewicz University
- A variant of match-end, but after replacement?, Marcin Borkowski, 2015/07/19
- Re: A variant of match-end, but after replacement?, Pascal J. Bourguignon, 2015/07/19
- Re: A variant of match-end, but after replacement?, Marcin Borkowski, 2015/07/19
- Message not available
- Re: A variant of match-end, but after replacement?, Pascal J. Bourguignon, 2015/07/19
- Re: A variant of match-end, but after replacement?,
Marcin Borkowski <=
- Re: A variant of match-end, but after replacement?, Dmitry Gutov, 2015/07/19
- Re: A variant of match-end, but after replacement?, Marcin Borkowski, 2015/07/19
- Message not available
- Re: A variant of match-end, but after replacement?, Pascal J. Bourguignon, 2015/07/19
- Re: A variant of match-end, but after replacement?, Marcin Borkowski, 2015/07/19
- Message not available
- Re: A variant of match-end, but after replacement?, Barry Margolin, 2015/07/19
- Re: A variant of match-end, but after replacement?, Pascal J. Bourguignon, 2015/07/19
- Re: A variant of match-end, but after replacement?, Marcin Borkowski, 2015/07/19
- Message not available
- Re: A variant of match-end, but after replacement?, Pascal J. Bourguignon, 2015/07/19