aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEli Zaretskii2008-10-21 14:01:33 +0000
committerEli Zaretskii2008-10-21 14:01:33 +0000
commit3645358ade97894b3e355fdd37f3c9e73d5d62bb (patch)
treee66cd3c974e46ad1f6236aece11c4fa55bcb56ce
parentbf190568e0cda0fa76d274fc4a74bb1d768a20e5 (diff)
downloademacs-3645358ade97894b3e355fdd37f3c9e73d5d62bb.tar.gz
emacs-3645358ade97894b3e355fdd37f3c9e73d5d62bb.zip
(Regexp Search): Document `string-match-p' and `looking-at-p'.
(POSIX Regexps): Add an xref for "non-greedy". (Regexp Special): Add @cindex entry for "non-greedy".
-rw-r--r--doc/lispref/ChangeLog5
-rw-r--r--doc/lispref/searching.texi19
-rw-r--r--etc/NEWS1
3 files changed, 22 insertions, 3 deletions
diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog
index 3308aa57db0..d3db94bc5fa 100644
--- a/doc/lispref/ChangeLog
+++ b/doc/lispref/ChangeLog
@@ -1,5 +1,10 @@
12008-10-21 Eli Zaretskii <eliz@gnu.org> 12008-10-21 Eli Zaretskii <eliz@gnu.org>
2 2
3 * searching.texi (Regexp Search): Document `string-match-p' and
4 `looking-at-p'.
5 (POSIX Regexps): Add an xref for "non-greedy".
6 (Regexp Special): Add @cindex entry for "non-greedy".
7
3 * display.texi (Attribute Functions): Document `face-all-attributes'. 8 * display.texi (Attribute Functions): Document `face-all-attributes'.
4 (Image Cache) <image-refresh>: Minor wording fixes. 9 (Image Cache) <image-refresh>: Minor wording fixes.
5 10
diff --git a/doc/lispref/searching.texi b/doc/lispref/searching.texi
index 36c3638b094..e5846028cfd 100644
--- a/doc/lispref/searching.texi
+++ b/doc/lispref/searching.texi
@@ -334,6 +334,7 @@ preceding expression either once or not at all. For example,
334@samp{ca?r} matches @samp{car} or @samp{cr}; nothing else. 334@samp{ca?r} matches @samp{car} or @samp{cr}; nothing else.
335 335
336@item @samp{*?}, @samp{+?}, @samp{??} 336@item @samp{*?}, @samp{+?}, @samp{??}
337@cindex non-greedy repetition characters in regexp
337These are ``non-greedy'' variants of the operators @samp{*}, @samp{+} 338These are ``non-greedy'' variants of the operators @samp{*}, @samp{+}
338and @samp{?}. Where those operators match the largest possible 339and @samp{?}. Where those operators match the largest possible
339substring (consistent with matching the entire containing expression), 340substring (consistent with matching the entire containing expression),
@@ -1060,6 +1061,11 @@ the match is available as @code{(match-end 0)}. @xref{Match Data}.
1060@end example 1061@end example
1061@end defun 1062@end defun
1062 1063
1064@defun string-match-p regexp string &optional start
1065This predicate function does what @code{string-match} does, but it has
1066no side effect of modifying the match data.
1067@end defun
1068
1063@defun looking-at regexp 1069@defun looking-at regexp
1064This function determines whether the text in the current buffer directly 1070This function determines whether the text in the current buffer directly
1065following point matches the regular expression @var{regexp}. ``Directly 1071following point matches the regular expression @var{regexp}. ``Directly
@@ -1069,7 +1075,8 @@ result is @code{t} if so, @code{nil} otherwise.
1069 1075
1070This function does not move point, but it updates the match data, which 1076This function does not move point, but it updates the match data, which
1071you can access using @code{match-beginning} and @code{match-end}. 1077you can access using @code{match-beginning} and @code{match-end}.
1072@xref{Match Data}. 1078@xref{Match Data}. If you need to test for a match without modifying
1079the match data, use @code{looking-at-p}, described below.
1073 1080
1074In this example, point is located directly before the @samp{T}. If it 1081In this example, point is located directly before the @samp{T}. If it
1075were anywhere else, the result would be @code{nil}. 1082were anywhere else, the result would be @code{nil}.
@@ -1113,6 +1120,11 @@ comes back" twice.
1113@end example 1120@end example
1114@end defun 1121@end defun
1115 1122
1123@defun looking-at-p regexp
1124This predicate function works like @code{looking-at}, but without
1125updating the match data.
1126@end defun
1127
1116@defvar search-spaces-regexp 1128@defvar search-spaces-regexp
1117If this variable is non-@code{nil}, it should be a regular expression 1129If this variable is non-@code{nil}, it should be a regular expression
1118that says how to search for whitespace. In that case, any group of 1130that says how to search for whitespace. In that case, any group of
@@ -1142,8 +1154,9 @@ match, as required by POSIX. This is much slower, so use these
1142functions only when you really need the longest match. 1154functions only when you really need the longest match.
1143 1155
1144 The POSIX search and match functions do not properly support the 1156 The POSIX search and match functions do not properly support the
1145non-greedy repetition operators. This is because POSIX backtracking 1157non-greedy repetition operators (@pxref{Regexp Special, non-greedy}).
1146conflicts with the semantics of non-greedy repetition. 1158This is because POSIX backtracking conflicts with the semantics of
1159non-greedy repetition.
1147 1160
1148@defun posix-search-forward regexp &optional limit noerror repeat 1161@defun posix-search-forward regexp &optional limit noerror repeat
1149This is like @code{re-search-forward} except that it performs the full 1162This is like @code{re-search-forward} except that it performs the full
diff --git a/etc/NEWS b/etc/NEWS
index cf45b4fc38f..81dd4930601 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1618,6 +1618,7 @@ consing shell command lines from the individual arguments.
1618*** `image-refresh' refreshes all images associated with a given image 1618*** `image-refresh' refreshes all images associated with a given image
1619specification. 1619specification.
1620 1620
1621+++
1621*** The two new functions `looking-at-p' and `string-match-p' can do 1622*** The two new functions `looking-at-p' and `string-match-p' can do
1622the same matching as `looking-at' and `string-match' without changing 1623the same matching as `looking-at' and `string-match' without changing
1623the match data. 1624the match data.