[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: I can't believe: replace regexp in a string

From: Stefan Monnier <address@hidden>
Subject: Re: I can't believe: replace regexp in a string
Date: 14 Feb 2003 10:55:08 -0500
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50

> somehow I can't believe it. When I try to replace a regexp in a string
> I have to create a temporary buffer and use the usual buffer
> replacement commands or write a loop over the sequence. Is that true?
> I have found a posting in this group describing that and have looked
> at the XEmacs sources of subr.el where a defun replace-in-string is
> defined which does one of the above procedures depending on the length
> of the string. Having coded in Perl a good deal this seems quite
> strange to me, but if it is the elispish way to do it, I'll give in

I'm not sure what's your complaint exactly.
Is it that XEmacs' replace-in-string is not standard in Emacs (this
is addressed in Emacs-21 with replace-regexp-in-string) or is it
that you find both implementations of replace-in-string inefficient
(how is it implemented in Perl) ?

Finally, the reason why it took so long for Emacs to provide
replace-regexp-in-string is because Emacs uses buffers a lot more than
strings, so if you need replace-regexp-in-string it's maybe because you
made the arguably wrong decision to use a string rather than a buffer.

Perl is great with strings, Emacs is great with buffers.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]