From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Barry Margolin Newsgroups: gmane.emacs.help Subject: Re: Stack overflow in regexp matcher Date: Thu, 17 Dec 2009 12:01:10 -0500 Organization: A noiseless patient Spider Message-ID: References: <8u-dncYjy6Q3iLTWnZ2dnUVZ8nKdnZ2d@posted.visi> NNTP-Posting-Host: lo.gmane.org X-Trace: ger.gmane.org 1261071990 31057 80.91.229.12 (17 Dec 2009 17:46:30 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 17 Dec 2009 17:46:30 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Dec 17 18:46:23 2009 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1NLKQf-0000i6-1O for geh-help-gnu-emacs@m.gmane.org; Thu, 17 Dec 2009 18:46:21 +0100 Original-Received: from localhost ([127.0.0.1]:38652 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NLKQf-0004hE-5c for geh-help-gnu-emacs@m.gmane.org; Thu, 17 Dec 2009 12:46:21 -0500 Original-Path: news.stanford.edu!usenet.stanford.edu!news.glorb.com!news2.glorb.com!news.glorb.com!feeder.erje.net!news2.arglkargh.de!news.mixmin.net!feeder.eternal-september.org!eternal-september.org!news.eternal-september.org!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 26 Original-X-Trace: news.eternal-september.org U2FsdGVkX18AkZOspxkOvQPj2OPo5Iw3tp5jkT731KvQRQUEv3qki6nrD2waosJr2NjTuQ6rPXtOJW2Bb6MiMwaV4K3pOapgX6RdkFTU2Q65B7VyklSMLZ15nNBIGlEOrb8LevvHas0= Original-X-Complaints-To: abuse@eternal-september.org Original-NNTP-Posting-Date: Thu, 17 Dec 2009 17:01:10 +0000 (UTC) User-Agent: MT-NewsWatcher/3.5.3b3 (Intel Mac OS X) X-Auth-Sender: U2FsdGVkX18+qiPEWPGXI/i2z19ZKQm3TDzmyGlqkF4= Cancel-Lock: sha1:7W1heZB5X1VKdaTkqg/Pq7YcWes= Original-Xref: news.stanford.edu gnu.emacs.help:175630 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:70704 Archived-At: In article <8u-dncYjy6Q3iLTWnZ2dnUVZ8nKdnZ2d@posted.visi>, "akaiser@visi.com" wrote: > A function of mine gets "Stack overflow in regexp matcher" on a certain > file using the regexp > > "^< \\(.+].+=|\\)" > > The file is a single line of about 73000 characters, but the regexp matches > ending at character 56. > > Is this a bug? And if not, why not? > > djc The problem is that + is greedy, so this has to scan the entire line looking for the last "]", then see if there's an "=" somewhere later. If it can't find an "=" it has to back up to the previous "]" and search again, and so on. If there are lots of "]" characters, this has to save the state of each of them in the matching stack. -- Barry Margolin, barmar@alum.mit.edu Arlington, MA *** PLEASE post questions in newsgroups, not directly to me *** *** PLEASE don't copy me on replies, I'll read them in the group ***