Function: count-matches

count-matches is a and interactive for how-many, defined in replace.el.gz.

Signature

(count-matches REGEXP &optional RSTART REND INTERACTIVE)

Documentation

Print and return number of matches for REGEXP following point.

When called from Lisp and INTERACTIVE is omitted or nil, just return the number, do not print it; if INTERACTIVE is t, the function behaves in all respects as if it had been called interactively.

If REGEXP contains upper case characters (excluding those preceded by \) and search-upper-case is non-nil, the matching is case-sensitive.

Second and third arg RSTART and REND specify the region to operate on.

Interactively, in Transient Mark mode when the mark is active, operate on the contents of the region. Otherwise, operate from point to the end of (the accessible portion of) the buffer.

This function starts looking for the next match from the end of the previous match. Hence, it ignores matches that overlap a previously found match.

Probably introduced at or before Emacs version 20.4.

Key Bindings

Aliases

count-matches