emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/lispref/searching.texi [lexbind]


From: Miles Bader
Subject: [Emacs-diffs] Changes to emacs/lispref/searching.texi [lexbind]
Date: Tue, 06 Jul 2004 07:10:58 -0400

Index: emacs/lispref/searching.texi
diff -c emacs/lispref/searching.texi:1.39.2.5 
emacs/lispref/searching.texi:1.39.2.6
*** emacs/lispref/searching.texi:1.39.2.5       Tue Feb 17 23:15:46 2004
--- emacs/lispref/searching.texi        Tue Jul  6 09:23:50 2004
***************
*** 244,256 ****
  The next alternative is for @samp{a*} to match only two @samp{a}s.  With
  this choice, the rest of the regexp matches address@hidden
  
! Nested repetition operators can be extremely slow if they specify
! backtracking loops.  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.
! The slowness is because Emacs must try each imaginable way of grouping
! the 35 @samp{x}s before concluding that none of them can work.  To make
! sure your regular expressions run fast, check nested repetitions
  carefully.
  
  @item @samp{+}
--- 244,258 ----
  The next alternative is for @samp{a*} to match only two @samp{a}s.  With
  this choice, the rest of the regexp matches address@hidden
  
! 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.
  
  @item @samp{+}




reply via email to

[Prev in Thread] Current Thread [Next in Thread]