help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: problem with elisp


From: Nikolaj Schumacher
Subject: Re: problem with elisp
Date: Wed, 08 Oct 2008 22:33:50 +0200
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.3 (darwin)

Seweryn Kokot <sewkokot@gmail.com> wrote:

> string-temp is changed to 5816MHs and in the end, the last 3 lines do
> nothing.
>
> Any idea how to solve the problem?

You can search for words only:

(re-search-forward (concat "\\b" (regexp-quote string-b) "\\b"))


Or you can give up the temp string and search for both at once like this:

(re-search-forward (concat "\\(" (regexp-quote string-a) "\\)\\|\\("
                           (regexp-quote string-a) "\\)"))

and then replace based on which one was found:

(if (match-beginning 1)
    (replace-match string-b)
  (replace-match string-a))

regards,
Nikolaj Schumacher




reply via email to

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