emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 7608b77d9e: Clarify Fmatch_data doc string


From: Lars Ingebrigtsen
Subject: master 7608b77d9e: Clarify Fmatch_data doc string
Date: Sat, 29 Jan 2022 10:40:41 -0500 (EST)

branch: master
commit 7608b77d9ee54e26ac61abb5132ac8c3c13f906a
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>

    Clarify Fmatch_data doc string
    
    * src/search.c (Fmatch_data): Note quirk about non-matching
    optional groups in the doc string (bug#29343).
---
 src/search.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/search.c b/src/search.c
index a1adfa2d8c..80541921de 100644
--- a/src/search.c
+++ b/src/search.c
@@ -2827,6 +2827,14 @@ All the elements are markers or nil (nil if the Nth pair 
didn't match)
 if the last match was on a buffer; integers or nil if a string was matched.
 Use `set-match-data' to reinstate the data in this list.
 
+Note that non-matching optional groups at the end of the regexp are
+elided instead of being represented with two `nil's each.  For instance:
+
+  (progn
+    (string-match "^\\(a\\)?\\(b\\)\\(c\\)?$" "b")
+    (match-data))
+  => (0 1 nil nil 0 1)
+
 If INTEGERS (the optional first argument) is non-nil, always use
 integers (rather than markers) to represent buffer positions.  In
 this case, and if the last match was in a buffer, the buffer will get



reply via email to

[Prev in Thread] Current Thread [Next in Thread]