From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Peter Neilson" Subject: Re: Stackoverflow in regexp matcher Date: Wed, 03 Feb 2016 06:44:17 -0500 Message-ID: References: <87oabzb4h8.fsf@hornfels.zedat.fu-berlin.de> <878u33dsh0.fsf@alphaville.usersys.redhat.com> <87y4b2qm7h.fsf@hornfels.zedat.fu-berlin.de> <87si1a9h2o.fsf@nicolasgoaziou.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:46459) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aQvrF-0008FD-1W for emacs-orgmode@gnu.org; Wed, 03 Feb 2016 06:44:26 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aQvr9-0000VR-Pe for emacs-orgmode@gnu.org; Wed, 03 Feb 2016 06:44:24 -0500 Received: from pacmmta55.windstream.net ([162.39.147.221]:42633) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aQvr9-0000VB-Lb for emacs-orgmode@gnu.org; Wed, 03 Feb 2016 06:44:19 -0500 In-Reply-To: <87si1a9h2o.fsf@nicolasgoaziou.fr> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org On Wed, 03 Feb 2016 06:19:43 -0500, Nicolas Goaziou wrote: > "Loris Bennett" 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."