comint-previous-matching-input
comint-previous-matching-input is an interactive compiled Lisp function in `comint.el
'.
(comint-previous-matching-input REGEXP N)
Search backwards through input history for match for REGEXP.
(Previous history elements are earlier commands.)
With prefix argument N, search for Nth previous match.
If N is negative, find the next or Nth next match.