diff options
| author | Richard M. Stallman | 2006-05-17 22:17:09 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 2006-05-17 22:17:09 +0000 |
| commit | bc023640a335ed2c8b7ddc239bc9489f78601c74 (patch) | |
| tree | dd7c7071eb8b5550dae53eaff33cb589570bf5c5 | |
| parent | 05327ca9724287cc3da4c625f180da5ab11be998 (diff) | |
| download | emacs-bc023640a335ed2c8b7ddc239bc9489f78601c74.tar.gz emacs-bc023640a335ed2c8b7ddc239bc9489f78601c74.zip | |
(Regexp Special): Clarify nested regexp warning.
| -rw-r--r-- | lispref/searching.texi | 8 |
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*} | |||
| 306 | first tries to match all three @samp{a}s; but the rest of the pattern is | 306 | first 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. |
| 308 | The next alternative is for @samp{a*} to match only two @samp{a}s. With | 308 | The next alternative is for @samp{a*} to match only two @samp{a}s. With |
| 309 | this choice, the rest of the regexp matches successfully.@refill | 309 | this choice, the rest of the regexp matches successfully. |
| 310 | 310 | ||
| 311 | Nested repetition operators take a long time, or even forever, if they | 311 | @strong{Warning:} Nested repetition operators take a long time, |
| 312 | or even forever, if they | ||
| 312 | lead to ambiguous matching. For example, trying to match the regular | 313 | lead to ambiguous matching. For example, trying to match the regular |
| 313 | expression @samp{\(x+y*\)*a} against the string | 314 | expression @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 |
| 318 | it causes an infinite loop. To avoid these problems, check nested | 319 | it causes an infinite loop. To avoid these problems, check nested |
| 319 | repetitions carefully. | 320 | repetitions carefully, to make sure that they do not cause combinatorial |
| 321 | explosions in backtracking. | ||
| 320 | 322 | ||
| 321 | @item @samp{+} | 323 | @item @samp{+} |
| 322 | @cindex @samp{+} in regexp | 324 | @cindex @samp{+} in regexp |