From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Dan Davison Newsgroups: gmane.emacs.help Subject: Stack overflow in regexp matcher Date: Sun, 06 Feb 2011 10:47:42 +0000 Message-ID: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1296989308 8857 80.91.229.12 (6 Feb 2011 10:48:28 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sun, 6 Feb 2011 10:48:28 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun Feb 06 11:48:24 2011 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.69) (envelope-from ) id 1Pm2AJ-0001TF-3L for geh-help-gnu-emacs@m.gmane.org; Sun, 06 Feb 2011 11:48:23 +0100 Original-Received: from localhost ([127.0.0.1]:57563 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Pm2AI-0002E9-MX for geh-help-gnu-emacs@m.gmane.org; Sun, 06 Feb 2011 05:48:22 -0500 Original-Received: from [140.186.70.92] (port=39100 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Pm29t-0002E4-Td for help-gnu-emacs@gnu.org; Sun, 06 Feb 2011 05:47:58 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Pm29s-0004uT-Nd for help-gnu-emacs@gnu.org; Sun, 06 Feb 2011 05:47:57 -0500 Original-Received: from lo.gmane.org ([80.91.229.12]:48088) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Pm29s-0004uP-En for help-gnu-emacs@gnu.org; Sun, 06 Feb 2011 05:47:56 -0500 Original-Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1Pm29r-0001Jw-0C for help-gnu-emacs@gnu.org; Sun, 06 Feb 2011 11:47:55 +0100 Original-Received: from 94.196.169.147.threembb.co.uk ([94.196.169.147]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 06 Feb 2011 11:47:54 +0100 Original-Received: from dandavison7 by 94.196.169.147.threembb.co.uk with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 06 Feb 2011 11:47:54 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 21 Original-X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: 94.196.169.147.threembb.co.uk User-Agent: Gnus/5.110011 (No Gnus v0.11) Emacs/24.0.50 (darwin) Cancel-Lock: sha1:f853ftnP6FiuIuBuFbUJgELh1nQ= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 80.91.229.12 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:78984 Archived-At: The following fails with "Stack overflow in regexp matcher" in emacs 23 and 24: (string-match "^\\[.+\\]$" (concat "[" (mapconcat (lambda (i) "x") (number-sequence 1 33500) "") "]")) This surprised me; I assumed that the ^ and $ anchors, and the simple ".+" requirement in the middle would result in a simple, efficient regexp. In this case I can replace this with a different test using `substring', but I'm curious: was the above obviously unwise to someone who knows about emacs regexps? What would be a better regexp be to use in this sutuation? Fwiw, The same match seems to work instantaneously in e.g. perl. Dan