unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Deniz Dogan <deniz.a.m.dogan@gmail.com>
To: suvayu ali <fatkasuvayu+linux@gmail.com>
Cc: Emacs mailing list <help-gnu-emacs@gnu.org>
Subject: Re: Regex is not being as "hungry" as it is supposed to
Date: Fri, 6 Aug 2010 06:04:18 +0200	[thread overview]
Message-ID: <AANLkTi=fdy305AoTSJegYexSd2yvyE5Z9dVvwxV0fPot@mail.gmail.com> (raw)
In-Reply-To: <AANLkTikbQObpji8fDto_2Fnt4hCiN2U5JAp=NqXDYCTD@mail.gmail.com>

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



  reply	other threads:[~2010-08-06  4:04 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

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='AANLkTi=fdy305AoTSJegYexSd2yvyE5Z9dVvwxV0fPot@mail.gmail.com' \
    --to=deniz.a.m.dogan@gmail.com \
    --cc=fatkasuvayu+linux@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /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).