From: Eli Zaretskii Date: Fri, 19 May 2006 19:47:14 +0000 (+0000) Subject: (Simple Match Data): Warn about match data being set anew by every search. X-Git-Tag: emacs-pretest-22.0.90~2489 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=5345f90dfa6444f1dd5428492d0133db97baec75;p=emacs.git (Simple Match Data): Warn about match data being set anew by every search. --- diff --git a/lispref/searching.texi b/lispref/searching.texi index 505122fdd16..e93cee42a3b 100644 --- a/lispref/searching.texi +++ b/lispref/searching.texi @@ -1264,6 +1264,12 @@ subexpression is numbered 1, the second 2, and so on. Only regular expressions can have subexpressions---after a simple string search, the only information available is about the entire match. + Every successful search sets the match data. Therefore, you should +query the match data immediately after searching, before calling any +other function that might perform another search. Alternatively, you +may save and restore the match data (@pxref{Saving Match Data}) around +the call to functions that could perform another search. + A search which fails may or may not alter the match data. In the past, a failing search did not do this, but we may change it in the future. So don't try to rely on the value of the match data after