[Top][All Lists]

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

Re: Advanced query-replace-regexp in code

From: Barry Margolin
Subject: Re: Advanced query-replace-regexp in code
Date: Wed, 27 May 2009 21:19:13 -0400
User-agent: MT-NewsWatcher/3.5.3b3 (Intel Mac OS X)

In article 
 Nordlöw <address@hidden> wrote:

> I can't get the following example to work programmatically.
>   M-x replace-regexp
>   Replace regexp:  \(\w+\)
>   Replace regexp with:  \,(capitalize \1)
> Is this only possible in interactive query-replace?
> If so should I use a combination of while(), looking-at(), re-search-
> forward(), replace-match(), match-string() etc.

Yes.  Notice that the documentation of replace-regexp says:

In interactive calls, the replacement text may contain `\,'

It's a special extension just for interactive use.  I'm not sure why it 
was restricted this way.

Barry Margolin, address@hidden
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
*** PLEASE don't copy me on replies, I'll read them in the group ***

reply via email to

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