X-Git-Url: http://git.chise.org/gitweb/?p=chise%2Fxemacs-chise.git.1;a=blobdiff_plain;f=man%2Flispref%2Fsearching.texi;h=243651463d9e1f400f3e20f650172d93efa42260;hp=db7eadcdf1ee07583bc883c98046ffd6cd2e1840;hb=59eec5f21669e81977b5b1fe9bf717cab49cf7fb;hpb=032d062ebcb2344e6245cea4214bc09835da97ee diff --git a/man/lispref/searching.texi b/man/lispref/searching.texi index db7eadc..2436514 100644 --- a/man/lispref/searching.texi +++ b/man/lispref/searching.texi @@ -273,17 +273,21 @@ match, it matches the shortest match. @samp{*?} is known as a @dfn{non-greedy} quantifier, a regexp construct borrowed from Perl. @c Did perl get this from somewhere? What's the real history of *? ? -This construct very useful for when you want to match the text inside a -pair of delimiters. For instance, @samp{/\*.*?\*/} will match C -comments in a string. This could not be achieved without the use of -greedy quantifier. +This construct is very useful for when you want to match the text inside +a pair of delimiters. For instance, @samp{/\*.*?\*/} will match C +comments in a string. This could not easily be achieved without the use +of a non-greedy quantifier. This construct has not been available prior to XEmacs 20.4. It is not available in FSF Emacs. @item +? @cindex @samp{+?} in regexp -is the @samp{+} analog to @samp{*?}. +is the non-greedy version of @samp{+}. + +@item ?? +@cindex @samp{??} in regexp +is the non-greedy version of @samp{?}. @item \@{n,m\@} @c Note the spacing after the close brace is deliberate. @@ -293,6 +297,9 @@ specifies that the expression must match at least @var{n} times, but no more than @var{m} times. This syntax is supported by most Unix regexp utilities, and has been introduced to XEmacs for the version 20.3. +Unfortunately, the non-greedy version of this quantifier does not exist +currently, although it does in Perl. + @item [ @dots{} ] @cindex character set (in regexp) @cindex @samp{[} in regexp @@ -462,8 +469,9 @@ is called a @dfn{shy} grouping operator, and it is used just like substring to be recorded for future reference. This is useful when you need a lot of grouping @samp{\( @dots{} \)} -constructs, but only want to remember one or two. Then you can use -not want to remember them for later use with @code{match-string}. +constructs, but only want to remember one or two -- or if you have +more than nine groupings and need to use backreferences to refer to +the groupings at the end. Using @samp{\(?: @dots{} \)} rather than @samp{\( @dots{} \)} when you don't need the captured substrings ought to speed up your programs some, @@ -472,7 +480,7 @@ engine, as well as the amount of memory allocation and string copying it must do. The actual performance gain to be observed has not been measured or quantified as of this writing. @c This is used to good advantage by the font-locking code, and by -@c `regexp-opt.el'. ... It will be. It's not yet, but will be. +@c `regexp-opt.el'. The shy grouping operator has been borrowed from Perl, and has not been available prior to XEmacs 20.3, nor is it available in FSF Emacs.