term-backward-matching-input
term-backward-matching-input is an interactive compiled Lisp function in `term.el
'.
(term-backward-matching-input REGEXP N)
Search backward through buffer for match for REGEXP.
Matches are searched for on lines that match `term-prompt-regexp'.
With prefix argument N, search for Nth previous match.
If N is negative, find the next or Nth next match.