Function: re-search-forward
re-search-forward is an interactive function defined in search.c.
Signature
(re-search-forward REGEXP &optional BOUND NOERROR COUNT)
Documentation
Search forward from point for regular expression REGEXP.
Set point to the end of the occurrence found, and return point.
The optional second argument BOUND is a buffer position that bounds
the search. The match found must not end after that position. A
value of nil means search to the end of the accessible portion of
the buffer.
The optional third argument NOERROR indicates how errors are handled
when the search fails: if it is nil or omitted, emit an error; if
it is t, simply return nil and do nothing; if it is neither nil nor
t, move to the limit of search and return nil.
The optional fourth argument COUNT is a number that indicates the
search direction and the number of occurrences to search for. If it
is positive, search forward for COUNT successive occurrences; if it
is negative, search backward, instead of forward, for -COUNT
occurrences. A value of nil means the same as 1.
With COUNT positive/negative, the match found is the COUNTth/-COUNTth
one in the buffer located entirely after/before the origin of the
search.
Search case-sensitivity is determined by the value of the variable
case-fold-search, which see.
See also the functions match-beginning, match-end, match-string,
and replace-match.
Other relevant functions are documented in the buffer and regexp groups.
Probably introduced at or before Emacs version 19.29.
Key Bindings
Shortdoc
;; regexp
(re-search-forward "^foo$" nil t)
e.g. => 43
;; buffer
(re-search-forward "some-s.*g" nil t)
e.g. => 245
Aliases
Source Code
// Defined in /usr/src/emacs/src/search.c
{
return search_command (regexp, bound, noerror, count, 1, true, false);
}