Regex and Fixed Strings/Show non-matching lines

Return the lines that do not match the pattern.

Section: Regex basics

Show non-matching lines

bash
bash
rg -v '^#' .env.example
Explanation

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
Match one of several patterns
Search for either of two words.
OpenIn sheetbashsame section
Match whole words only
Avoid partial matches inside larger identifiers.
OpenIn sheetbashsame section
Match numeric fragments
Find three-digit numeric sequences.
OpenIn sheetbashsame section
Use capture groups in patterns
Group pieces of a regex for readability or PCRE2 replacements.
OpenIn sheetbashsame section
Search as a plain literal string
Disable regex parsing and match the text exactly.
OpenIn sheetbash1 tag match
Use the PCRE2 engine
Turn on advanced regex features such as look-around.
OpenIn sheetbash1 tag match