# HG changeset patch # User Richard M. Stallman # Date 1016703442 0 # Node ID 32211007711cbc7491a0f649a721d5db03204a76 # Parent f816ded285dd71a623ab06364c2570ad5fc8ff31 Clarify non-greedy repetition in searching. diff -r f816ded285dd -r 32211007711c man/search.texi --- a/man/search.texi Thu Mar 21 09:35:35 2002 +0000 +++ b/man/search.texi Thu Mar 21 09:37:22 2002 +0000 @@ -463,6 +463,13 @@ match), while @samp{ab*?} will match just @samp{a} (the shortest valid match). +Non-greedy operators match the shortest possible string starting at a +given starting point; in a forward search, though, the earliest +possible starting point for match is always the one chosen. Thus, if +you search for @samp{a.*?$} against the text @samp{abbab} followed by +a newline, it matches the whole string. Since it @emph{can} match +starting at the first @samp{a}, it does. + @item \@{@var{n}\@} is a postfix operator that specifies repetition @var{n} times---that is, the preceding regular expression must match exactly @var{n} times