/[emacs]/emacs/lispref/searching.texi
ViewVC logotype

Diff of /emacs/lispref/searching.texi

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.39.2.5 by uid65618, Tue Feb 17 23:15:46 2004 UTC revision 1.39.2.6 by miles, Tue Jul 6 09:23:50 2004 UTC
# Line 244  first tries to match all three @samp{a}s Line 244  first tries to match all three @samp{a}s
244  The next alternative is for @samp{a*} to match only two @samp{a}s.  With  The next alternative is for @samp{a*} to match only two @samp{a}s.  With
245  this choice, the rest of the regexp matches successfully.@refill  this choice, the rest of the regexp matches successfully.@refill
246    
247  Nested repetition operators can be extremely slow if they specify  Nested repetition operators can be extremely slow or loop infinitely
248  backtracking loops.  For example, it could take hours for the regular  if they use repetition operators inside repetition operators.  For
249  expression @samp{\(x+y*\)*a} to try to match the sequence  example, it could take hours for the regular expression
250  @samp{xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxz}, before it ultimately fails.  @samp{\(x+y*\)*a} to try to match the sequence
251  The slowness is because Emacs must try each imaginable way of grouping  @samp{xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxz}, before it ultimately
252  the 35 @samp{x}s before concluding that none of them can work.  To make  fails.  Emacs must try each way of grouping the 35 @samp{x}s before
253  sure your regular expressions run fast, check nested repetitions  concluding that none of them can work.  Even worse, @samp{\(x*\)*} can
254    match the null string in infinitely many ways, so it causes an
255    infinite loop.  To avoid these problems, check nested repetitions
256  carefully.  carefully.
257    
258  @item @samp{+}  @item @samp{+}

Legend:
Removed from v.1.39.2.5  
changed lines
  Added in v.1.39.2.6

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26