summaryrefslogtreecommitdiff
path: root/lispref
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>2000-01-03 05:26:02 +0000
committerRichard M. Stallman <rms@gnu.org>2000-01-03 05:26:02 +0000
commitc082a348817327e116816121adb27a243b4b4bfc (patch)
treecf313f1305d0685d8ad39c4efce17439397df612 /lispref
parent8964fec710c90c9dcb9795806a585c1c43116279 (diff)
downloademacs-c082a348817327e116816121adb27a243b4b4bfc.tar.gz
*** empty log message ***
Diffstat (limited to 'lispref')
-rw-r--r--lispref/searching.texi13
1 files changed, 13 insertions, 0 deletions
diff --git a/lispref/searching.texi b/lispref/searching.texi
index f4c4eca1fe2..062fc40ec76 100644
--- a/lispref/searching.texi
+++ b/lispref/searching.texi
@@ -264,6 +264,19 @@ is a postfix operator, similar to @samp{*} except that it must match the
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