Function: search-forward

search-forward is an interactive function defined in search.c.

Signature

(search-forward STRING &optional BOUND NOERROR COUNT)

Documentation

Search forward from point for STRING.

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 group.

View in manual

Probably introduced at or before Emacs version 18.

Key Bindings

Shortdoc

;; buffer
(search-forward "some-string" nil t)
    e.g. => 245

Source Code

// Defined in /usr/src/emacs/src/search.c
{
  return search_command (string, bound, noerror, count, 1, false, false);
}