comparison lispref/searching.texi @ 70741:0e29340d15dc

(Simple Match Data): Warn about match data being set anew by every search.
author Eli Zaretskii <eliz@gnu.org>
date Fri, 19 May 2006 19:47:14 +0000
parents f03812b51969
children 28a1d231aeec a8190f7e546e
comparison
equal deleted inserted replaced
70740:f263eba56074 70741:0e29340d15dc
1262 @samp{\(} from the beginning of the whole regular expression. The first 1262 @samp{\(} from the beginning of the whole regular expression. The first
1263 subexpression is numbered 1, the second 2, and so on. Only regular 1263 subexpression is numbered 1, the second 2, and so on. Only regular
1264 expressions can have subexpressions---after a simple string search, the 1264 expressions can have subexpressions---after a simple string search, the
1265 only information available is about the entire match. 1265 only information available is about the entire match.
1266 1266
1267 Every successful search sets the match data. Therefore, you should
1268 query the match data immediately after searching, before calling any
1269 other function that might perform another search. Alternatively, you
1270 may save and restore the match data (@pxref{Saving Match Data}) around
1271 the call to functions that could perform another search.
1272
1267 A search which fails may or may not alter the match data. In the 1273 A search which fails may or may not alter the match data. In the
1268 past, a failing search did not do this, but we may change it in the 1274 past, a failing search did not do this, but we may change it in the
1269 future. So don't try to rely on the value of the match data after 1275 future. So don't try to rely on the value of the match data after
1270 a failing search. 1276 a failing search.
1271 1277