Match text spanning lines using a more powerful regex engine.
Section: Literal and escaped searches
Search a literal pattern with PCRE2 multiline support
bash
bash
rg -Pzo 'BEGIN.*?END' notes.txtExplanation
Use PCRE2 plus multiline/null-data modes when the default engine's line-oriented behavior is too strict.
Learn the surrounding workflow
Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.
Related commands
Same sheet · prioritizing Literal and escaped searches
Search as a plain literal string
Disable regex parsing and match the text exactly.
Match several literal patterns
Provide multiple literal patterns in one command.
Escape regex metacharacters
Search for a literal dot while staying in regex mode.