comparison man/search.texi @ 28063:f1b33463506d

*** empty log message ***
author Stefan Monnier <monnier@iro.umontreal.ca>
date Wed, 08 Mar 2000 23:26:00 +0000
parents 5c14849aee4c
children e7cf77f27506
comparison
equal deleted inserted replaced
28062:26edef632c89 28063:f1b33463506d
430 are non-greedy variants of the operators above. The normal operators 430 are non-greedy variants of the operators above. The normal operators
431 @samp{*}, @samp{+}, @samp{?} are @dfn{greedy} in that they match as much 431 @samp{*}, @samp{+}, @samp{?} are @dfn{greedy} in that they match as much
432 as they can, while if you append a @samp{?} after them, it makes them 432 as they can, while if you append a @samp{?} after them, it makes them
433 non-greedy: they will match as little as possible. 433 non-greedy: they will match as little as possible.
434 434
435 @item \@{n,m\@} 435 @item \@{@var{n},@var{m}\@}
436 is another postfix operator that specifies an interval of iteration: 436 is another postfix operator that specifies an interval of iteration:
437 the preceding regular expression must match between @samp{n} and 437 the preceding regular expression must match between @var{n} and
438 @samp{m} times. If @samp{m} is omitted, then there is no upper bound 438 @var{m} times. If @var{m} is omitted, then there is no upper bound
439 and if @samp{,m} is omitted, then the regular expression must match 439 and if @var{,m} is omitted, then the regular expression must match
440 exactly @samp{n} times. @* 440 exactly @var{n} times. @*
441 @samp{\@{0,1\@}} is equivalent to @samp{?}. @* 441 @samp{\@{0,1\@}} is equivalent to @samp{?}. @*
442 @samp{\@{0,\@}} is equivalent to @samp{*}. @* 442 @samp{\@{0,\@}} is equivalent to @samp{*}. @*
443 @samp{\@{1,\@}} is equivalent to @samp{+}. @* 443 @samp{\@{1,\@}} is equivalent to @samp{+}. @*
444 @samp{\@{n\@}} is equivalent to @samp{\@{n,n\@}}. 444 @samp{\@{@var{n}\@}} is equivalent to @samp{\@{@var{n},@var{n}\@}}.
445 445
446 @item [ @dots{} ] 446 @item [ @dots{} ]
447 is a @dfn{character set}, which begins with @samp{[} and is terminated 447 is a @dfn{character set}, which begins with @samp{[} and is terminated
448 by @samp{]}. In the simplest case, the characters between the two 448 by @samp{]}. In the simplest case, the characters between the two
449 brackets are what this set can match. 449 brackets are what this set can match.
558 @end enumerate 558 @end enumerate
559 559
560 This last application is not a consequence of the idea of a 560 This last application is not a consequence of the idea of a
561 parenthetical grouping; it is a separate feature that is assigned as a 561 parenthetical grouping; it is a separate feature that is assigned as a
562 second meaning to the same @samp{\( @dots{} \)} construct. In practice 562 second meaning to the same @samp{\( @dots{} \)} construct. In practice
563 there is no conflict between the two meanings. 563 there is almost no conflict between the two meanings.
564
565 @item \(?: @dots{} \)
566 is another grouping construct (often called ``shy'') that serves the same
567 first two purposes, but not the third:
568 it cannot be referred to later on by number. This is only useful
569 for mechanically constructed regular expressions where grouping
570 constructs need to be introduced implicitly and hence risk changing the
571 numbering of subsequent groups.
564 572
565 @item \@var{d} 573 @item \@var{d}
566 matches the same text that matched the @var{d}th occurrence of a 574 matches the same text that matched the @var{d}th occurrence of a
567 @samp{\( @dots{} \)} construct. 575 @samp{\( @dots{} \)} construct.
568 576