* re-builder vs replace-regexp
@ 2011-11-24 19:24 Андрей Парамонов
2011-11-25 8:25 ` Andreas Röhler
2011-11-25 9:22 ` Eric Abrahamsen
0 siblings, 2 replies; 3+ messages in thread
From: Андрей Парамонов @ 2011-11-24 19:24 UTC (permalink / raw)
To: help-gnu-emacs
Re-Builder is a great tool. It allows interactive search with
incredibly handy highlight, subexpression mode, etc. However, one
often needs not just search by regexp, but also perform regexp
replace. I thought reb-copy command would help me to pass my regexp to
replace-regexp. But replace-regexp doesn't understand the result of
reb-copy, i.e. for default *scratch* buffer the following regexp works
in Re-Builder:
"\\(file\\)"
but to make it suitable for search-forward-regexp/replace-regexp I
need to manually adjust it to
\(file\)
I find it really inconvenient (the larger regexp the more
inconvenient). Should I report a bug, or I'm missing something basic?
I'm running GNU Emacs 23.3.1.
Best wishes,
Andrey Paramonov
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: re-builder vs replace-regexp
2011-11-24 19:24 re-builder vs replace-regexp Андрей Парамонов
@ 2011-11-25 8:25 ` Andreas Röhler
2011-11-25 9:22 ` Eric Abrahamsen
1 sibling, 0 replies; 3+ messages in thread
From: Andreas Röhler @ 2011-11-25 8:25 UTC (permalink / raw)
To: help-gnu-emacs
Am 24.11.2011 20:24, schrieb Андрей Парамонов:
> Re-Builder is a great tool. It allows interactive search with
> incredibly handy highlight, subexpression mode, etc. However, one
> often needs not just search by regexp, but also perform regexp
> replace. I thought reb-copy command would help me to pass my regexp to
> replace-regexp. But replace-regexp doesn't understand the result of
> reb-copy, i.e. for default *scratch* buffer the following regexp works
> in Re-Builder:
>
> "\\(file\\)"
>
> but to make it suitable for search-forward-regexp/replace-regexp I
> need to manually adjust it to
>
> \(file\)
>
> I find it really inconvenient (the larger regexp the more
> inconvenient). Should I report a bug, or I'm missing something basic?
> I'm running GNU Emacs 23.3.1.
>
> Best wishes,
> Andrey Paramonov
>
>
Hi Andrey,
think these are valid considerations on the road.
A lot of questions are around.
For example using Regexps are one way. Exist other procedures.
Also writing a function to perform replacements is faster in some cases
then doing it with just one regexp.
In all cases being tempted to use such a tool, rather split the issue.
Writing a function which changes
> "\\(file\\)"
>
> \(file\)
should be a way to proceed.
HTH,
Andreas
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: re-builder vs replace-regexp
2011-11-24 19:24 re-builder vs replace-regexp Андрей Парамонов
2011-11-25 8:25 ` Andreas Röhler
@ 2011-11-25 9:22 ` Eric Abrahamsen
1 sibling, 0 replies; 3+ messages in thread
From: Eric Abrahamsen @ 2011-11-25 9:22 UTC (permalink / raw)
To: help-gnu-emacs
On Fri, Nov 25 2011, Андрей Парамонов wrote:
> Re-Builder is a great tool. It allows interactive search with
> incredibly handy highlight, subexpression mode, etc. However, one
> often needs not just search by regexp, but also perform regexp
> replace. I thought reb-copy command would help me to pass my regexp to
> replace-regexp. But replace-regexp doesn't understand the result of
> reb-copy, i.e. for default *scratch* buffer the following regexp works
> in Re-Builder:
>
> "\\(file\\)"
>
> but to make it suitable for search-forward-regexp/replace-regexp I
> need to manually adjust it to
>
> \(file\)
>
> I find it really inconvenient (the larger regexp the more
> inconvenient). Should I report a bug, or I'm missing something basic?
> I'm running GNU Emacs 23.3.1.
Try the library re-builder+, at
http://www.emacswiki.org/emacs/re-builder+.el
It provides `reb+-replace-regexp' which is something like what you want.
Personally, I think a nice solution would be a function bound to a key
in re-builder mode that takes the present regexp, modifies it to work
with replace-regexp and family, and then places it on the re search
history. You hit the key, go to do your search or replace or whatever,
and then hit M-p to call up that regexp. That sort of thing wouldn't be
too hard to cobble together if you look at the code in re-builder+
(this is basically a note to self).
Eric
--
GNU Emacs 24.0.91.1 (i686-pc-linux-gnu, GTK+ Version 2.24.6)
of 2011-11-07 on pellet
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-11-25 9:22 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-24 19:24 re-builder vs replace-regexp Андрей Парамонов
2011-11-25 8:25 ` Andreas Röhler
2011-11-25 9:22 ` Eric Abrahamsen
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.