Q: (how) can I use occur
to match a phrase that
stretches over multiple lines?
Consider the following buffer:
Here's a line of text with the phrase "kittens and puppies".
Here's an awkward alternative: the phrase "kittens and
puppies" stretches across two lines.
Here's a false positive: "kittens and otters".
I'd like to identify all the locations in the buffer that contain
the phrase "kittens and puppies". If I use occur
, however, the
following two problems arise:
- the phrase "kittens and puppies" matches only the first line, and not the second/third where the phrase wraps over a line break.
- the phrase "kittens" (or "kittens and") also matches the false positive on the last line.
How, if at all, can I use occur
to locate the relevant lines in
the buffer -- those that contain the entire phrase, or the
beginning of one that wraps across lines? If occur
can't do it,
is there an occur
-like alternative that can?