... the file has multiple lines but the KEY and PATTERN values don't fall on their own line as my original example illustrates.
No matter. Just don't use the ^ $ embedded newline anchors at the beginnings and ends of your start and stop patterns. (Of course, they can still be used elsewhere.) See discussions of the m regex modifier (Modifiers) in perlre and other cited refs. The example string in Re: pattern matching (greedy, non-greedy,...) has no newlines in it at all, anywhere!
Update: Oops. This reply would have been better as an update to Re^3: pattern matching (greedy, non-greedy,...).In reply to Re^3: pattern matching (greedy, non-greedy,...)
by AnomalousMonk
in thread pattern matching (greedy, non-greedy,...)
by cacophony777
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |