changeset 27095:7cc86d68ccf8

*** empty log message ***
author Richard M. Stallman <rms@gnu.org>
date Mon, 03 Jan 2000 05:26:02 +0000
parents 6500fd0a7d8e
children e200e2db8e99
files lispref/searching.texi
diffstat 1 files changed, 13 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/lispref/searching.texi	Mon Jan 03 00:29:21 2000 +0000
+++ b/lispref/searching.texi	Mon Jan 03 05:26:02 2000 +0000
@@ -264,6 +264,19 @@
 preceding expression either once or not at all.  For example,
 @samp{ca?r} matches @samp{car} or @samp{cr}; nothing else.
 
+@item @samp{*?}, @samp{+?}, @samp{??}
+These are ``non-greedy'' variants of the operators @samp{*}, @samp{+}
+and @samp{?}.  Where those operators match the largest possible
+substring (consistent with matching the entire containing expression),
+the non-greedy variants match the smallest possible substring
+(consistent with matching the entire containing expression).
+
+For example, the regular expression @samp{c[ad]*a} when applied to the
+string @samp{cdaaada} matches the whole string; but the regular
+expression @samp{c[ad]*?a}, applied to that same string, matches just
+@samp{cda}.  (The smallest possible match here for @samp{[ad]*?} that
+permits the whole expression to match is @samp{d}.)
+
 @item @samp{[ @dots{} ]}
 @cindex character alternative (in regexp)
 @cindex @samp{[} in regexp