/[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.60 by kfstorm, Wed Jun 15 15:19:41 2005 UTC revision 1.61 by rms, Sat Jun 18 13:56:16 2005 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 or loop infinitely  Nested repetition operators take a long time, or even forever, if they
248  if they use repetition operators inside repetition operators.  For  lead to ambiguous matching.  For example, trying to match the regular
249  example, it could take hours for the regular expression  expression @samp{\(x+y*\)*a} against the string
250  @samp{\(x+y*\)*a} to try to match the sequence  @samp{xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxz} could take hours before it
251  @samp{xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxz}, before it ultimately  ultimately fails.  Emacs must try each way of grouping the 35
252  fails.  Emacs must try each way of grouping the 35 @samp{x}s before  @samp{x}s before concluding that none of them can work.  Even worse,
253  concluding that none of them can work.  Even worse, @samp{\(x*\)*} can  @samp{\(x*\)*} can match the null string in infinitely many ways, so
254  match the null string in infinitely many ways, so it causes an  it causes an infinite loop.  To avoid these problems, check nested
255  infinite loop.  To avoid these problems, check nested repetitions  repetitions carefully.
 carefully.  
256    
257  @item @samp{+}  @item @samp{+}
258  @cindex @samp{+} in regexp  @cindex @samp{+} in regexp
# Line 347  different characters. Line 346  different characters.
346    
347  @item @samp{[^ @dots{} ]}  @item @samp{[^ @dots{} ]}
348  @cindex @samp{^} in regexp  @cindex @samp{^} in regexp
349  @samp{[^} begins a @dfn{complemented character alternative}, which matches any  @samp{[^} begins a @dfn{complemented character alternative}.  This
350  character except the ones specified.  Thus, @samp{[^a-z0-9A-Z]} matches  matches any character except the ones specified.  Thus,
351  all characters @emph{except} letters and digits.  @samp{[^a-z0-9A-Z]} matches all characters @emph{except} letters and
352    digits.
353    
354  @samp{^} is not special in a character alternative unless it is the first  @samp{^} is not special in a character alternative unless it is the first
355  character.  The character following the @samp{^} is treated as if it  character.  The character following the @samp{^} is treated as if it

Legend:
Removed from v.1.60  
changed lines
  Added in v.1.61

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