* Possible bug in replace-regexp?
@ 2007-11-20 23:59 Moira
2007-11-21 9:47 ` Peter Dyballa
0 siblings, 1 reply; 4+ messages in thread
From: Moira @ 2007-11-20 23:59 UTC (permalink / raw)
To: help-gnu-emacs
Hi.
I've just attempted some regular expression search/replace in emacs -
a thing I like to do in editors - and noticed some strange behaviour.
I thought I'd rather ask here before posting a bug-report to early.
If my search contains a grouped quantor like this "myString\(.*?\)" a
C-q,C-j newline in the replacement is added *before* the groups
backreference, even if it's placed behind it.
Like in this replace: "myString\1[emacs C-q,C-j comes here]".
This should yield:
>>>
...
some-stuff
myString more-stuff-in-the-myString-line
the-rest
...
<<<
Instead it causes this:
>>>
...
some-stuff
myString
more-stuff-in-the-myString-line the-rest
...
<<<
I should add that this is Aquaemacs, a native GUI Emacs port for OS
X. I haven't tried it the CLI version yet and I'm not 100% sure C-q,C-
j is the way of putting a newline into the replacement.
Is this a bug (read: can you guys reproduce it?) and/or are there
other ways to approach this problem?
Thanks for any advice and input on the subject.
Phillip
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Possible bug in replace-regexp?
2007-11-20 23:59 Possible bug in replace-regexp? Moira
@ 2007-11-21 9:47 ` Peter Dyballa
0 siblings, 0 replies; 4+ messages in thread
From: Peter Dyballa @ 2007-11-21 9:47 UTC (permalink / raw)
To: Moira; +Cc: help-gnu-emacs
Am 21.11.2007 um 00:59 schrieb Moira:
> I should add that this is Aquaemacs
For me Aquamacs Emacs, the Carbon Emacs as distributed by David
Reitter, does not work since last year. I have at least one other GNU
Emacs too many. In none of them. not even the Cocoa Emacs.app, the
same happens.
Your from expression is a bit unconventional: .*? – what can the ? do
that .* are not able to do? Prevent greediness?
I'd recommend to repeat the test in a new instance of Aquamacs Emacs
and then view with C-h l what exactly you did enter. If you can see
from the *Help* buffer that no C-j or such was entered by you and the
result of replace-regexp is still the same as described in your
eMail, then it's time to choose 'Report Bug' from Aquamacs Emacs'
Help menu.
BTW, Aquamacs Emacs has its own list:
---------------------------- Info -----------------------------
List Post: <mailto:macosx-emacs@email.esm.psu.edu>
List Archives: <http://dir.gmane.org/gmane.emacs.macintosh.osx>
--
Mit friedvollen Grüßen
Pete
Math illiteracy affects 7 out of every 5 Americans.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Possible bug in replace-regexp?
[not found] <mailman.3861.1195603200.18990.help-gnu-emacs@gnu.org>
@ 2007-11-22 22:45 ` David Reitter
2007-11-22 23:42 ` Johan Bockgård
1 sibling, 0 replies; 4+ messages in thread
From: David Reitter @ 2007-11-22 22:45 UTC (permalink / raw)
To: help-gnu-emacs
On Nov 20, 11:59 pm, Moira <mo...@demetria.de> wrote:
> If my search contains a grouped quantor like this "myString\(.*?\)" a
> C-q,C-j newline in the replacement is added *before* the groups
> backreference, even if it's placed behind it.
> Like in this replace: "myString\1[emacs C-q,C-j comes here]".
I just tried to reproduce that with the latest version from CVS (based
on Emacs 22 CVS) and I can't reproduce this.
If there is still a bug, it's likely to be right in GNU Emacs (since
we don't mess around with Search/Replace functions)
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Possible bug in replace-regexp?
[not found] <mailman.3861.1195603200.18990.help-gnu-emacs@gnu.org>
2007-11-22 22:45 ` David Reitter
@ 2007-11-22 23:42 ` Johan Bockgård
1 sibling, 0 replies; 4+ messages in thread
From: Johan Bockgård @ 2007-11-22 23:42 UTC (permalink / raw)
To: help-gnu-emacs
Moira <moira@demetria.de> writes:
> If my search contains a grouped quantor like this "myString\(.*?\)" a
> C-q,C-j newline in the replacement is added *before* the groups
> backreference, even if it's placed behind it.
> Like in this replace: "myString\1[emacs C-q,C-j comes here]".
*? is non-greedy. \1 is the empty string.
--
Johan Bockgård
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2007-11-22 23:42 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-20 23:59 Possible bug in replace-regexp? Moira
2007-11-21 9:47 ` Peter Dyballa
[not found] <mailman.3861.1195603200.18990.help-gnu-emacs@gnu.org>
2007-11-22 22:45 ` David Reitter
2007-11-22 23:42 ` Johan Bockgård
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.