diff options
| author | Richard M. Stallman | 2002-03-21 09:37:22 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 2002-03-21 09:37:22 +0000 |
| commit | bed0fc913cfff3f02eba6c7ee5e2fe144f3f1465 (patch) | |
| tree | 803022fedba82ca76dee99f64b304abd4f2ce7a4 | |
| parent | 54f035751f81b76bf177b41cefebf0716be91cec (diff) | |
| download | emacs-bed0fc913cfff3f02eba6c7ee5e2fe144f3f1465.tar.gz emacs-bed0fc913cfff3f02eba6c7ee5e2fe144f3f1465.zip | |
Clarify non-greedy repetition in searching.
| -rw-r--r-- | man/search.texi | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/man/search.texi b/man/search.texi index 36ed3747154..1739f93bc8d 100644 --- a/man/search.texi +++ b/man/search.texi | |||
| @@ -463,6 +463,13 @@ the text @samp{abbb}, @samp{ab*} will match it all (the longest valid | |||
| 463 | match), while @samp{ab*?} will match just @samp{a} (the shortest | 463 | match), while @samp{ab*?} will match just @samp{a} (the shortest |
| 464 | valid match). | 464 | valid match). |
| 465 | 465 | ||
| 466 | Non-greedy operators match the shortest possible string starting at a | ||
| 467 | given starting point; in a forward search, though, the earliest | ||
| 468 | possible starting point for match is always the one chosen. Thus, if | ||
| 469 | you search for @samp{a.*?$} against the text @samp{abbab} followed by | ||
| 470 | a newline, it matches the whole string. Since it @emph{can} match | ||
| 471 | starting at the first @samp{a}, it does. | ||
| 472 | |||
| 466 | @item \@{@var{n}\@} | 473 | @item \@{@var{n}\@} |
| 467 | is a postfix operator that specifies repetition @var{n} times---that | 474 | is a postfix operator that specifies repetition @var{n} times---that |
| 468 | is, the preceding regular expression must match exactly @var{n} times | 475 | is, the preceding regular expression must match exactly @var{n} times |