Here are some possibilities that aren't very slick, that have the advantage of working with a stock Emacs.
If you press
M-s o (
isearch-occur) during an incremental search, an Occur buffer pops up with the current search expression. At the top of the
*Occur* buffer is the number of matching lines.
how-many displays the number of occurrences of a regexp (including repeated occurrences). Unfortunately it isn't integrated with incremental search. Here's a proof-of-concept isearch integration: press
M-s # during isearch to show the number of matches.
(defun isearch-how-many (regexp)
"Run `how-many' using the last search string as the regexp.
Interactively, REGEXP is constructed as with `isearch-occur'."
(funcall isearch-word isearch-string))
(isearch-word (word-search-regexp isearch-string))
(t (regexp-quote isearch-string)))))
(how-many regexp nil nil (interactive-p)))
(define-key isearch-mode-map [?\M-s ?#] 'isearch-how-many)