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

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

Re: Storing regular expressions somewhere....


From: Johan Bockgård
Subject: Re: Storing regular expressions somewhere....
Date: Wed, 23 Aug 2006 17:45:51 +0200
User-agent: Gnus/5.110006 (No Gnus v0.6) Emacs/22.0.50 (gnu/linux)

"Birju Prajapati" <floating.buddha@gmail.com> writes:

> On 23/08/06, Birju Prajapati <floating.buddha@gmail.com> wrote:
>> Hi all,
>> Sometimes I need to do complicated replace-regexps. However, they
>> can be prone to errors, so what I end up doing is an
>> isearch-forward-regexp until I get the expression correct. Once it
>> is correct, I write it down and then type it back into a
>> replace-regexp command! Rather cumbersome....Is there some sort of
>> isearch-forwared-replace-regexp command ? Or can I recall the
>> previous regexp searched for in my isearch-forward-regexp?

You can type `M-e' in isearch and then copy the string from there.

(In Emacs 22 you can run query replace directly from isearch with
`M-%'.)

Also, if you set `query-replace-interactive' to non-nil, replacements
will reuse the last search string automatically.

> After digging around a bit, I found M-x regexp-builder. However,
> this doesn't seem to understand predefined character classes such as
> \s- and seems to have a different regexp syntax. Is this a bug or am
> I doing something wrong?

By default backslashes have to be doubled (like inside a Lisp string).
Try

  (setq reb-re-syntax 'string)

-- 
Johan Bockgård


reply via email to

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