GNU bug report logs - #12622
replace-regexp-in-string

Previous Next

Package: emacs;

Reported by: Andreas Röhler <andreas.roehler <at> easy-emacs.de>

Date: Thu, 11 Oct 2012 14:19:02 UTC

Severity: normal

Tags: notabug

Done: Glenn Morris <rgm <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Andreas Röhler <andreas.roehler <at> easy-emacs.de>
To: Andreas Schwab <schwab <at> linux-m68k.org>
Cc: 12622 <at> debbugs.gnu.org
Subject: bug#12622: replace-regexp-in-string
Date: Fri, 12 Oct 2012 08:32:39 +0200
Am 11.10.2012 18:52, schrieb Andreas Schwab:
> Andreas Röhler <andreas.roehler <at> easy-emacs.de> writes:
>
>> (setq mystring "[.A foobar] [.B baz]")
>> (replace-regexp-in-string "\\_<\\w+\\_>" (concat "\\\\" (match-string-no-properties 0)) mystring) ==>
>>
>>   "[.A \\ext in that fi] [.B \\ext in that fi]"
>>
>> for example,
>>
>> Docstring says:
>>
>> "If it is a function, it is called with the actual text of each
>> match, and its value is used as the replacement text."
>>
>> Which is not the case AFAIS.
>
> You are not passing a function.
>
> Andreas.
>

okay.

that works:

(replace-regexp-in-string "\\_<\\w+\\_>" (lambda (x) (concat "\\\\" x)) mystring)

Nonetheless consider it a design flaw, us it requires a argument taking function, where a expression just to evaluate would suffice.

Andreas





This bug report was last modified 12 years and 225 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.