summaryrefslogtreecommitdiff
path: root/doc/lispref/searching.texi
diff options
context:
space:
mode:
authorMattias EngdegÄrd <mattiase@acm.org>2020-05-03 14:22:50 +0200
committerMattias EngdegÄrd <mattiase@acm.org>2020-05-03 14:27:51 +0200
commit63268253d21c57d991cba3f3b083d74f154a26fe (patch)
tree71a8e85776ec60d3a68e2c8a9cad4b2fa37e2719 /doc/lispref/searching.texi
parent7f51ab5163635aa6bc369b5173af955c6a27f927 (diff)
downloademacs-63268253d21c57d991cba3f3b083d74f154a26fe.tar.gz
Regexps cannot infloop; fix manual
* doc/lispref/searching.texi (Regexp Special): Edit erroneous statements about infinite looping in regexps.
Diffstat (limited to 'doc/lispref/searching.texi')
-rw-r--r--doc/lispref/searching.texi10
1 files changed, 4 insertions, 6 deletions
diff --git a/doc/lispref/searching.texi b/doc/lispref/searching.texi
index 83c154938cd..c8a12bdd66b 100644
--- a/doc/lispref/searching.texi
+++ b/doc/lispref/searching.texi
@@ -338,16 +338,14 @@ first tries to match all three @samp{a}s; but the rest of the pattern is
The next alternative is for @samp{a*} to match only two @samp{a}s. With
this choice, the rest of the regexp matches successfully.
-@strong{Warning:} Nested repetition operators can run for an
-indefinitely long time, if they lead to ambiguous matching. For
+@strong{Warning:} Nested repetition operators can run for a very
+long time, if they lead to ambiguous matching. For
example, trying to match the regular expression @samp{\(x+y*\)*a}
against the string @samp{xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxz} could
take hours before it ultimately fails. Emacs must try each way of
grouping the @samp{x}s before concluding that none of them can work.
-Even worse, @samp{\(x*\)*} can match the null string in infinitely
-many ways, so it causes an infinite loop. To avoid these problems,
-check nested repetitions carefully, to make sure that they do not
-cause combinatorial explosions in backtracking.
+In general, avoid expressions that can match the same string in
+multiple ways.
@item @samp{+}
@cindex @samp{+} in regexp