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 the parenthesized subexpression in the last
  regexp for which to return the start position.
Value is nil if SUBEXPth subexpression didn't match, or there were fewer
  than SUBEXP subexpressions.
SUBEXP 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);
}