comint-backward-matching-input
comint-backward-matching-input is an interactive compiled Lisp function in `comint.el
'.
(comint-backward-matching-input REGEXP N)
Search backward through buffer for input fields that match REGEXP.
If `comint-use-prompt-regexp' is non-nil, then input fields are identified
by lines that match `comint-prompt-regexp'.
With prefix argument N, search for Nth previous match.
If N is negative, find the next or Nth next match.