unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Stack overflow in regexp matcher
@ 2009-12-16 17:15 akaiser
  2009-12-17 17:01 ` Barry Margolin
  0 siblings, 1 reply; 12+ messages in thread
From: akaiser @ 2009-12-16 17:15 UTC (permalink / raw)
  To: help-gnu-emacs

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


^ permalink raw reply	[flat|nested] 12+ messages in thread
* Stack overflow in regexp matcher
@ 2011-02-06 10:47 Dan Davison
  2011-02-06 13:31 ` Stephen Berman
  0 siblings, 1 reply; 12+ messages in thread
From: Dan Davison @ 2011-02-06 10:47 UTC (permalink / raw)
  To: help-gnu-emacs

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




^ permalink raw reply	[flat|nested] 12+ messages in thread
[parent not found: <mailman.0.1296989279.10345.help-gnu-emacs@gnu.org>]

end of thread, other threads:[~2011-02-08 22:58 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-16 17:15 Stack overflow in regexp matcher akaiser
2009-12-17 17:01 ` Barry Margolin
2009-12-17 22:10   ` Ilya Zakharevich
2009-12-17 22:13   ` akaiser
  -- strict thread matches above, loose matches on Subject: below --
2011-02-06 10:47 Dan Davison
2011-02-06 13:31 ` Stephen Berman
2011-02-06 14:01   ` guivho
2011-02-06 14:17   ` Eli Zaretskii
2011-02-06 14:30     ` Dan Davison
2011-02-06 16:02     ` Stephen Berman
     [not found] <mailman.0.1296989279.10345.help-gnu-emacs@gnu.org>
2011-02-07 20:24 ` Stefan Monnier
2011-02-08 22:58   ` Dan Davison

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