unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Jari Aalto <jari.aalto@cante.net>
To: 7227@debbugs.gnu.org
Cc: Andreas Schwab <schwab@linux-m68k.org>
Subject: bug#7227: re-search-forward goes infinite loop with dash inside []
Date: Sat, 16 Oct 2010 16:42:00 +0300	[thread overview]
Message-ID: <87eibqp847.fsf_-_@picasso.cante.net> (raw)
In-Reply-To: <1213200935.4147.62.camel@cyberelk.elk> (Tim Waugh's message of "Wed, 11 Jun 2008 17:15:35 +0100")

Andreas Schwab <schwab@linux-m68k.org> writes:

> Jari Aalto <jari.aalto@cante.net> writes:
>
>> Executing the following code causes Emacs to go into infinite loop.
>> Simply run it behind the last paren with C-x C-e
>>
>> (re-search-forward "^\\([a-z0-9.-]+\\)+[ \t]+\\([0-9]+\\) +\\([a-z].*\\)")
>
> Works fine here.

Hm. The test case needs adjustment:

;; (1) Run C-x C-e, works:

(re-search-forward "^\\([a-z0-9.-]+\\)+[ \t]+\\([0-9]+\\) +\\([a-z].*\\)")
row2    1234 rest of line

;; (2) but C-x C-e below causes a loop

(re-search-forward "^\\([a-z0-9.-]+\\)+[ \t]+\\([0-9]+\\) +\\([a-z].*\\)")
------------------------------------------------------------------------
row2    1234 rest of line

> Note that nested repetitions like \([...]+\)+ are bad in any case.

This was only a test. The anchor "^" should help, and I assume the first
'[a-z0-9.-]+' should be greedy, so it shouldn't take that long to
resolve.

Jari





       reply	other threads:[~2010-10-16 13:42 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <r6eo4w45.fsf@blue.sea.net>
     [not found] ` <1213200935.4147.62.camel@cyberelk.elk>
2010-10-16 13:42   ` Jari Aalto [this message]
2010-10-16 13:54     ` bug#7227: re-search-forward goes infinite loop with dash inside [] Andreas Schwab
2010-11-16 21:25   ` bug#7408: Linux patchutils: Development of the project? Jari Aalto
2010-11-16 21:59     ` Lennart Borgman
2010-11-16 22:21     ` Stefan Monnier
2010-11-17  4:47       ` jari
2010-11-17  8:25         ` Glenn Morris
2010-11-17 13:39         ` Stefan Monnier
2010-11-17 12:47       ` Štěpán Němec
2010-11-17 13:39         ` Stefan Monnier
2010-11-18 22:02           ` bug#7408: 23.2.1 dolist -- subr.el and cl-macs differ with nil-block return Jari Aalto
2010-11-21  5:45             ` Stefan Monnier
2010-11-21  9:08               ` jari
2010-11-21 17:49                 ` Eli Zaretskii
2010-11-21 18:51                 ` Stefan Monnier
2010-11-17 14:18         ` bug#7408: Linux patchutils: Development of the project? martin rudalics
2010-10-16  9:16 bug#7227: re-search-forward goes infinite loop with dash inside [] Jari Aalto
2010-10-16 11:27 ` Andreas Schwab
2010-10-16 11:39 ` Andreas Röhler
2010-10-22  7:55 ` bug#7227: Close bts:gnu Jari Aalto

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=87eibqp847.fsf_-_@picasso.cante.net \
    --to=jari.aalto@cante.net \
    --cc=7227@debbugs.gnu.org \
    --cc=schwab@linux-m68k.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.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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).