|
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) |
"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.htmlThe 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."
[Prev in Thread] | Current Thread | [Next in Thread] |