* Regex is not being as "hungry" as it is supposed to
@ 2010-08-06 1:37 suvayu ali
2010-08-06 4:04 ` Deniz Dogan
0 siblings, 1 reply; 7+ messages in thread
From: suvayu ali @ 2010-08-06 1:37 UTC (permalink / raw)
To: Emacs mailing list
Hi everyone,
I have a strange problem, recently some of my regexps started becoming
less "hungry" than usual. For example I have a file like this,
#1 153030 120 = 423988
#2 152845 181 = 1500234
#3 155160 247 = 767821
#4 155160 310 = 11131347
#5 155160 319 = 13979167
I wanted to remove the 3rd column of numbers along with the = sign. So
I called `query-replace-regexp' with this regexp replacement,
`[0-9]+ = ->'
But this matches the numbers like this,
120 =
1 =
7 =
0 =
9 =
where as I am expecting it to be this,
120 =
181 =
247 =
310 =
319 =
This is just one instance, I have faced similar other cases. I get the
proper expected match only for the first match, for the subsequent
matches the regexp becomes less "hungry".
Is this a consequence of some conflicting settings or a possible bug?
I see this behaviour with GNU Emacs 24.0.50.1, emacs-snapshot from an
Ubuntu Lucid ppa and emacs compiled from source on Fedora 12. (but the
settings are identical for both these setups)
Thanks in advance for any comments/hints about this issue. :)
--
Suvayu
Open source is the future. It sets us free.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Regex is not being as "hungry" as it is supposed to
2010-08-06 1:37 Regex is not being as "hungry" as it is supposed to suvayu ali
@ 2010-08-06 4:04 ` Deniz Dogan
2010-08-06 6:29 ` Andreas Röhler
0 siblings, 1 reply; 7+ messages in thread
From: Deniz Dogan @ 2010-08-06 4:04 UTC (permalink / raw)
To: suvayu ali; +Cc: Emacs mailing list
2010/8/6 suvayu ali <fatkasuvayu+linux@gmail.com>:
> Hi everyone,
>
> I have a strange problem, recently some of my regexps started becoming
> less "hungry" than usual. For example I have a file like this,
>
> #1 153030 120 = 423988
> #2 152845 181 = 1500234
> #3 155160 247 = 767821
> #4 155160 310 = 11131347
> #5 155160 319 = 13979167
>
> I wanted to remove the 3rd column of numbers along with the = sign. So
> I called `query-replace-regexp' with this regexp replacement,
>
> `[0-9]+ = ->'
>
> But this matches the numbers like this,
>
> 120 =
> 1 =
> 7 =
> 0 =
> 9 =
>
> where as I am expecting it to be this,
>
> 120 =
> 181 =
> 247 =
> 310 =
> 319 =
>
> This is just one instance, I have faced similar other cases. I get the
> proper expected match only for the first match, for the subsequent
> matches the regexp becomes less "hungry".
>
> Is this a consequence of some conflicting settings or a possible bug?
> I see this behaviour with GNU Emacs 24.0.50.1, emacs-snapshot from an
> Ubuntu Lucid ppa and emacs compiled from source on Fedora 12. (but the
> settings are identical for both these setups)
>
> Thanks in advance for any comments/hints about this issue. :)
>
> --
> Suvayu
>
> Open source is the future. It sets us free.
>
>
That's weird, it happens to me to on:
GNU Emacs 24.0.50.1 (i386-mingw-nt6.1.7600) of 2010-07-12 on 3249CTO
I noticed two things when tinkering around with this problem.
1. M-x re-builder correctly highlights the portions we both expect.
2. It's only the *highlighting* in query-replace-regexp that
fails. When performing the actual replacing, it works just as
expected.
I'm sensing that this is a bug of some sort and you should report it.
--
Deniz Dogan
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Regex is not being as "hungry" as it is supposed to
2010-08-06 4:04 ` Deniz Dogan
@ 2010-08-06 6:29 ` Andreas Röhler
2010-08-06 6:49 ` Tassilo Horn
0 siblings, 1 reply; 7+ messages in thread
From: Andreas Röhler @ 2010-08-06 6:29 UTC (permalink / raw)
To: help-gnu-emacs
Am 06.08.2010 06:04, schrieb Deniz Dogan:
> 2010/8/6 suvayu ali<fatkasuvayu+linux@gmail.com>:
>> Hi everyone,
>>
>> I have a strange problem, recently some of my regexps started becoming
>> less "hungry" than usual. For example I have a file like this,
>>
>> #1 153030 120 = 423988
>> #2 152845 181 = 1500234
>> #3 155160 247 = 767821
>> #4 155160 310 = 11131347
>> #5 155160 319 = 13979167
>>
>> I wanted to remove the 3rd column of numbers along with the = sign. So
>> I called `query-replace-regexp' with this regexp replacement,
>>
>> `[0-9]+ = ->'
>>
>> But this matches the numbers like this,
>>
>> 120 =
>> 1 =
>> 7 =
>> 0 =
>> 9 =
>>
>> where as I am expecting it to be this,
>>
>> 120 =
>> 181 =
>> 247 =
>> 310 =
>> 319 =
>>
>> This is just one instance, I have faced similar other cases. I get the
>> proper expected match only for the first match, for the subsequent
>> matches the regexp becomes less "hungry".
>>
>> Is this a consequence of some conflicting settings or a possible bug?
>> I see this behaviour with GNU Emacs 24.0.50.1, emacs-snapshot from an
>> Ubuntu Lucid ppa and emacs compiled from source on Fedora 12. (but the
>> settings are identical for both these setups)
>>
>> Thanks in advance for any comments/hints about this issue. :)
>>
>> --
>> Suvayu
>>
>> Open source is the future. It sets us free.
>>
>>
>
> That's weird, it happens to me to on:
> GNU Emacs 24.0.50.1 (i386-mingw-nt6.1.7600) of 2010-07-12 on 3249CTO
>
> I noticed two things when tinkering around with this problem.
>
> 1. M-x re-builder correctly highlights the portions we both expect.
> 2. It's only the *highlighting* in query-replace-regexp that
> fails. When performing the actual replacing, it works just as
> expected.
>
> I'm sensing that this is a bug of some sort and you should report it.
>
same at
GNU Emacs 23.1.92.1 (i686-pc-linux-gnu, GTK+ Version 2.12.0) of 2010-02-19
replacement works as desribed, just the highlighting fails.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Regex is not being as "hungry" as it is supposed to
2010-08-06 6:29 ` Andreas Röhler
@ 2010-08-06 6:49 ` Tassilo Horn
2010-08-06 7:03 ` suvayu ali
0 siblings, 1 reply; 7+ messages in thread
From: Tassilo Horn @ 2010-08-06 6:49 UTC (permalink / raw)
To: help-gnu-emacs
Andreas Röhler <andreas.roehler@easy-emacs.de> writes:
> same at
>
> GNU Emacs 23.1.92.1 (i686-pc-linux-gnu, GTK+ Version 2.12.0) of 2010-02-19
>
> replacement works as desribed, just the highlighting fails.
Ditto with the current emacs 24 bzr trunk. I've reported the bug as
#6808.
Bye,
Tassilo
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Regex is not being as "hungry" as it is supposed to
2010-08-06 6:49 ` Tassilo Horn
@ 2010-08-06 7:03 ` suvayu ali
2010-08-06 7:36 ` Andreas Röhler
0 siblings, 1 reply; 7+ messages in thread
From: suvayu ali @ 2010-08-06 7:03 UTC (permalink / raw)
To: Tassilo Horn; +Cc: help-gnu-emacs
On 5 August 2010 23:49, Tassilo Horn <tassilo@member.fsf.org> wrote:
> Andreas Röhler <andreas.roehler@easy-emacs.de> writes:
>
>> same at
>>
>> GNU Emacs 23.1.92.1 (i686-pc-linux-gnu, GTK+ Version 2.12.0) of 2010-02-19
>>
>> replacement works as desribed, just the highlighting fails.
Usually when I see the highlighting is wrong I don't proceed with the
replace. I guess that is why I didn't pick up on the fact that the
highlighting is the problem. :-p
After seeing all the responses I proceeded with the replace, and I see
the same behaviour. Thank you every one for confirming this.
>
> Ditto with the current emacs 24 bzr trunk. I've reported the bug as
> #6808.
>
Thanks a lot Tassilo! :)
> Bye,
> Tassilo
>
--
Suvayu
Open source is the future. It sets us free.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Regex is not being as "hungry" as it is supposed to
2010-08-06 7:03 ` suvayu ali
@ 2010-08-06 7:36 ` Andreas Röhler
2010-08-07 0:44 ` suvayu ali
0 siblings, 1 reply; 7+ messages in thread
From: Andreas Röhler @ 2010-08-06 7:36 UTC (permalink / raw)
To: help-gnu-emacs
Am 06.08.2010 09:03, schrieb suvayu ali:
> On 5 August 2010 23:49, Tassilo Horn<tassilo@member.fsf.org> wrote:
>> Andreas Röhler<andreas.roehler@easy-emacs.de> writes:
>>
>>> same at
>>>
>>> GNU Emacs 23.1.92.1 (i686-pc-linux-gnu, GTK+ Version 2.12.0) of 2010-02-19
>>>
>>> replacement works as desribed, just the highlighting fails.
>
> Usually when I see the highlighting is wrong I don't proceed with the
> replace. I guess that is why I didn't pick up on the fact that the
> highlighting is the problem. :-p
>
> After seeing all the responses I proceeded with the replace, and I see
> the same behaviour. Thank you every one for confirming this.
>
>>
>> Ditto with the current emacs 24 bzr trunk. I've reported the bug as
>> #6808.
>>
>
> Thanks a lot Tassilo! :)
>
>> Bye,
>> Tassilo
>>
>
BTW, as running into difficulties with regexps is common:
quite often helps ancoring it
^\(.+ \)[0-9]+ =
\1
circumvents the bug
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Regex is not being as "hungry" as it is supposed to
2010-08-06 7:36 ` Andreas Röhler
@ 2010-08-07 0:44 ` suvayu ali
0 siblings, 0 replies; 7+ messages in thread
From: suvayu ali @ 2010-08-07 0:44 UTC (permalink / raw)
To: Andreas Röhler; +Cc: help-gnu-emacs
On 6 August 2010 00:36, Andreas Röhler <andreas.roehler@easy-emacs.de> wrote:
>
> BTW, as running into difficulties with regexps is common:
> quite often helps ancoring it
>
> ^\(.+ \)[0-9]+ =
>
> \1
>
> circumvents the bug
>
Thank you for this suggestion! :) Whenever working with sed I usually
do that. I guess its good practice when using regexps interactively in
emacs too.
--
Suvayu
Open source is the future. It sets us free.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2010-08-07 0:44 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-06 1:37 Regex is not being as "hungry" as it is supposed to suvayu ali
2010-08-06 4:04 ` Deniz Dogan
2010-08-06 6:29 ` Andreas Röhler
2010-08-06 6:49 ` Tassilo Horn
2010-08-06 7:03 ` suvayu ali
2010-08-06 7:36 ` Andreas Röhler
2010-08-07 0:44 ` suvayu ali
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.