unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: bojohan+news@dd.chalmers.se (Johan Bockgård)
Subject: Re: Storing regular expressions somewhere....
Date: Wed, 23 Aug 2006 17:45:51 +0200	[thread overview]
Message-ID: <yoijk64ze9qo.fsf@gamma02.me.chalmers.se> (raw)
In-Reply-To: mailman.5508.1156345825.9609.help-gnu-emacs@gnu.org

"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

  parent reply	other threads:[~2006-08-23 15:45 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-23 14:05 Storing regular expressions somewhere Birju Prajapati
2006-08-23 15:10 ` Birju Prajapati
2006-08-23 15:27 ` Drew Adams
     [not found] ` <mailman.5508.1156345825.9609.help-gnu-emacs@gnu.org>
2006-08-23 15:45   ` Johan Bockgård [this message]
  -- strict thread matches above, loose matches on Subject: below --
2006-08-23 18:29 Jay Bingham

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=yoijk64ze9qo.fsf@gamma02.me.chalmers.se \
    --to=bojohan+news@dd.chalmers.se \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).