occur is an interactive compiled Lisp function in `replace'. (occur REGEXP &optional NLINES)
Show all lines in the current buffer containing a match for REGEXP.
If a match spreads across multiple lines, all those lines are shown.
Each line is displayed with NLINES lines before and after, or -NLINES before if NLINES is negative. NLINES defaults to `list-matching-lines-default-context-lines'. Interactively it is the prefix arg.
The lines are shown in a buffer named `*Occur*'. It serves as a menu to find any of the occurrences in this buffer. C-h m in that buffer will explain how.
If REGEXP contains upper case characters (excluding those preceded by `\'), the matching is case-sensitive.