bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#7227: re-search-forward goes infinite loop with dash inside []


From: Jari Aalto
Subject: bug#7227: re-search-forward goes infinite loop with dash inside []
Date: Sat, 16 Oct 2010 16:42:00 +0300
User-agent: Gnus/5.110011 (No Gnus v0.11) Emacs/23.2 (gnu/linux)

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 via email to

[Prev in Thread] Current Thread [Next in Thread]