comint-forward-matching-input is an interactive compiled Lisp function in `comint.el'.

(comint-forward-matching-input REGEXP N)

Search forward 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 following match.
If N is negative, find the previous or Nth previous match.