all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Peter Neilson" <neilson@windstream.net>
To: emacs-orgmode@gnu.org
Subject: Re: Stackoverflow in regexp matcher
Date: Wed, 03 Feb 2016 06:44:17 -0500	[thread overview]
Message-ID: <op.yb89j3icrns8nc@odin> (raw)
In-Reply-To: <87si1a9h2o.fsf@nicolasgoaziou.fr>

On Wed, 03 Feb 2016 06:19:43 -0500, Nicolas Goaziou  
<mail@nicolasgoaziou.fr> wrote:

> "Loris Bennett" <loris.bennett@fu-berlin.de> 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."

      parent reply	other threads:[~2016-02-03 11:44 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-02 13:56 Stackoverflow in regexp matcher Loris Bennett
2016-02-02 15:47 ` Nick Dokos
2016-02-03  7:36   ` Loris Bennett
2016-02-03 11:19     ` Nicolas Goaziou
2016-02-03 11:34       ` Loris Bennett
2016-02-03 17:50         ` Alan Schmitt
2016-02-04  7:30           ` Loris Bennett
2016-02-03 11:44       ` Peter Neilson [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=op.yb89j3icrns8nc@odin \
    --to=neilson@windstream.net \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.