comparison lispref/searching.texi @ 49809:4556482b5d22

Clarify that match data is unpredictable after failing searches.
author Richard M. Stallman <rms@gnu.org>
date Sat, 15 Feb 2003 19:27:40 +0000
parents 23a1cea22d13
children 264cc4bc5c57
comparison
equal deleted inserted replaced
49808:6a37bab32791 49809:4556482b5d22
1253 1253
1254 @node Simple Match Data 1254 @node Simple Match Data
1255 @subsection Simple Match Data Access 1255 @subsection Simple Match Data Access
1256 1256
1257 This section explains how to use the match data to find out what was 1257 This section explains how to use the match data to find out what was
1258 matched by the last search or match operation. 1258 matched by the last search or match operation, if it succeeded.
1259 1259
1260 You can ask about the entire matching text, or about a particular 1260 You can ask about the entire matching text, or about a particular
1261 parenthetical subexpression of a regular expression. The @var{count} 1261 parenthetical subexpression of a regular expression. The @var{count}
1262 argument in the functions below specifies which. If @var{count} is 1262 argument in the functions below specifies which. If @var{count} is
1263 zero, you are asking about the entire match. If @var{count} is 1263 zero, you are asking about the entire match. If @var{count} is
1271 expressions can have subexpressions---after a simple string search, the 1271 expressions can have subexpressions---after a simple string search, the
1272 only information available is about the entire match. 1272 only information available is about the entire match.
1273 1273
1274 A search which fails may or may not alter the match data. In the 1274 A search which fails may or may not alter the match data. In the
1275 past, a failing search did not do this, but we may change it in the 1275 past, a failing search did not do this, but we may change it in the
1276 future. 1276 future. So don't try to rely on the value of the match data after
1277 a failing search.
1277 1278
1278 @defun match-string count &optional in-string 1279 @defun match-string count &optional in-string
1279 This function returns, as a string, the text matched in the last search 1280 This function returns, as a string, the text matched in the last search
1280 or match operation. It returns the entire text if @var{count} is zero, 1281 or match operation. It returns the entire text if @var{count} is zero,
1281 or just the portion corresponding to the @var{count}th parenthetical 1282 or just the portion corresponding to the @var{count}th parenthetical