Return the lines that do not match the pattern.
Section: Regex basics
Show non-matching lines
bash
bash
rg -v '^#' .env.exampleExplanation
Great for removing comments or blank-line noise in quick inspections.
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 Regex basics
Use capture groups in patterns
Group pieces of a regex for readability or PCRE2 replacements.
Search as a plain literal string
Disable regex parsing and match the text exactly.