diff options
Diffstat (limited to 'lispref/searching.texi')
-rw-r--r-- | lispref/searching.texi | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/lispref/searching.texi b/lispref/searching.texi index 38a0f4915d7..f2f21458506 100644 --- a/lispref/searching.texi +++ b/lispref/searching.texi @@ -244,16 +244,15 @@ 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.@refill -Nested repetition operators can be extremely slow or loop infinitely -if they use repetition operators inside repetition operators. For -example, it could take hours for the regular expression -@samp{\(x+y*\)*a} to try to match the sequence -@samp{xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxz}, before it ultimately -fails. Emacs must try each way of grouping the 35 @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. +Nested repetition operators take a long time, or even forever, if they +lead to ambiguous matching. For example, trying to match the regular +expression @samp{\(x+y*\)*a} against the string +@samp{xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxz} could take hours before it +ultimately fails. Emacs must try each way of grouping the 35 +@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. @item @samp{+} @cindex @samp{+} in regexp @@ -347,9 +346,10 @@ different characters. @item @samp{[^ @dots{} ]} @cindex @samp{^} in regexp -@samp{[^} begins a @dfn{complemented character alternative}, which matches any -character except the ones specified. Thus, @samp{[^a-z0-9A-Z]} matches -all characters @emph{except} letters and digits. +@samp{[^} begins a @dfn{complemented character alternative}. This +matches any character except the ones specified. Thus, +@samp{[^a-z0-9A-Z]} matches all characters @emph{except} letters and +digits. @samp{^} is not special in a character alternative unless it is the first character. The character following the @samp{^} is treated as if it |