463 |
match), while @samp{ab*?} will match just @samp{a} (the shortest |
match), while @samp{ab*?} will match just @samp{a} (the shortest |
464 |
valid match). |
valid match). |
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 |
|
|
473 |
@item \@{@var{n}\@} |
@item \@{@var{n}\@} |
474 |
is a postfix operator that specifies repetition @var{n} times---that |
is a postfix operator that specifies repetition @var{n} times---that |
475 |
is, the preceding regular expression must match exactly @var{n} times |
is, the preceding regular expression must match exactly @var{n} times |