aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman2006-05-17 22:17:09 +0000
committerRichard M. Stallman2006-05-17 22:17:09 +0000
commitbc023640a335ed2c8b7ddc239bc9489f78601c74 (patch)
treedd7c7071eb8b5550dae53eaff33cb589570bf5c5
parent05327ca9724287cc3da4c625f180da5ab11be998 (diff)
downloademacs-bc023640a335ed2c8b7ddc239bc9489f78601c74.tar.gz
emacs-bc023640a335ed2c8b7ddc239bc9489f78601c74.zip
(Regexp Special): Clarify nested regexp warning.
-rw-r--r--lispref/searching.texi8
1 files changed, 5 insertions, 3 deletions
diff --git a/lispref/searching.texi b/lispref/searching.texi
index 644376f5cdd..505122fdd16 100644
--- a/lispref/searching.texi
+++ b/lispref/searching.texi
@@ -306,9 +306,10 @@ matching @samp{ca*ar} against the string @samp{caaar}, the @samp{a*}
306first tries to match all three @samp{a}s; but the rest of the pattern is 306first tries to match all three @samp{a}s; but the rest of the pattern is
307@samp{ar} and there is only @samp{r} left to match, so this try fails. 307@samp{ar} and there is only @samp{r} left to match, so this try fails.
308The next alternative is for @samp{a*} to match only two @samp{a}s. With 308The next alternative is for @samp{a*} to match only two @samp{a}s. With
309this choice, the rest of the regexp matches successfully.@refill 309this choice, the rest of the regexp matches successfully.
310 310
311Nested repetition operators take a long time, or even forever, if they 311@strong{Warning:} Nested repetition operators take a long time,
312or even forever, if they
312lead to ambiguous matching. For example, trying to match the regular 313lead to ambiguous matching. For example, trying to match the regular
313expression @samp{\(x+y*\)*a} against the string 314expression @samp{\(x+y*\)*a} against the string
314@samp{xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxz} could take hours before it 315@samp{xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxz} could take hours before it
@@ -316,7 +317,8 @@ ultimately fails. Emacs must try each way of grouping the 35
316@samp{x}s before concluding that none of them can work. Even worse, 317@samp{x}s before concluding that none of them can work. Even worse,
317@samp{\(x*\)*} can match the null string in infinitely many ways, so 318@samp{\(x*\)*} can match the null string in infinitely many ways, so
318it causes an infinite loop. To avoid these problems, check nested 319it causes an infinite loop. To avoid these problems, check nested
319repetitions carefully. 320repetitions carefully, to make sure that they do not cause combinatorial
321explosions in backtracking.
320 322
321@item @samp{+} 323@item @samp{+}
322@cindex @samp{+} in regexp 324@cindex @samp{+} in regexp