emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] Stackoverflow in regexp matcher


From: Peter Neilson
Subject: Re: [O] Stackoverflow in regexp matcher
Date: Wed, 03 Feb 2016 06:44:17 -0500
User-agent: Opera Mail/12.16 (Linux)

On Wed, 03 Feb 2016 06:19:43 -0500, Nicolas Goaziou <address@hidden> wrote:

"Loris Bennett" <address@hidden> writes:

  re-search-forward("^[^%]*\\\\usepackage.*{biblatex}" nil t)

This is a pathological regexp. [^%] is anything but a percent sign, so
it can contain newline characters. Basically [^%]* can match an entire
buffer if it doesn't contain any %.

I think the regexp used in `reftex-using-biblatex-p' should be

  "^[^%\n]*\\\\usepackage.*{biblatex}"

Here's a link about the extreme difficulty of detecting pathological regular expressions:

https://mail.python.org/pipermail/python-dev/2003-May/035916.html

The author analyses the exponential not-found situation for (x+x+)+y and then suggests that for larger expressions, "... no more than 1 programmer in 1000 has even a vague idea how to start looking for such problems."



reply via email to

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