Function: match-beginning

match-beginning is a function defined in search.c.

Signature

(match-beginning SUBEXP)

Documentation

Return position of start of text matched by last search.

SUBEXP, a number, specifies which parenthesized expression in the last
  regexp.
Value is nil if SUBEXPth pair didn't match, or there were less than
  SUBEXP pairs.
Zero means the entire text matched by the whole regexp or whole string.

Return value is undefined if the last search failed.

Other relevant functions are documented in the regexp group.

View in manual

Probably introduced at or before Emacs version 17.

Shortdoc

;; regexp
(match-beginning 1)
    e.g. => 0

Aliases

pcomplete-match-beginning (obsolete since 29.1)

Source Code

// Defined in /usr/src/emacs/src/search.c
{
  return match_limit (subexp, 1);
}