Skip to content

Ripgrep Cheatsheet: Advanced Search Techniques & Examples

Master ripgrep with our comprehensive cheatsheet, featuring advanced search techniques, sorting options, and unique command examples to streamline your coding and security research.

Perfect for developers and security professionals seeking efficiency and precision.


Sort by
rg --sort none      # (Default) Do not sort results. Fastest. Can be multi-threaded.
rg --sort path      # Sort by file path. Always single-threaded.
rg --sort modified  # Sort by the last modified time on a file. Always single-threaded.
rg --sort accessed  # Sort by the last accessed time on a file. Always single-threaded.
rg --sort created   # Sort by the creation time on a file. Always single-threaded.
Sort by descending order
rg --sortr none      # (Default) Do not sort results. Fastest. Can be multi-threaded.
rg --sortr path      # Sort by file path. Always single-threaded.
rg --sortr modified  # Sort by the last modified time on a file. Always single-threaded.
rg --sortr accessed  # Sort by the last accessed time on a file. Always single-threaded.
rg --sortr created   # Sort by the creation time on a file. Always single-threaded.
Search for all files of the protocols
rg -o '\b(https?|ftp|sftp|ftps|smb|rsync):\/\/[^\s"<>]+' | awk '!seen[$0]++'
Search for all files of the protocols
rg -o '\b(https?|ftp|sftp|ftps|smb|rsync):\/\/[^\s"<>]+'
Search for all https urls
rg -o 'https:\/\/[^\s"<>]+'
Search for all protocol urls and avoid numbering / filenames
rg  --no-filename -N -o '\b(https?|ftp|sftp|ftps|smb|rsync):\/\/[^\s"<>]+' 
Search for match of protocol and include searching in zip files
rg --search-zip  --no-filename -N -o '\b(https?|ftp|sftp|ftps|smb|rsync):\/\/[^\s"<>]+'
Search for all urls that contain a zip file extension
rg --search-zip  --no-filename -N -o '\b(https?|ftp|sftp|ftps|smb|rsync):\/\/[^\s"<>]+zip'
Search for all urls that contain a zip file extension
rg --search-zip --no-filename -N -o '\b(https?|ftp|sftp|ftps|smb|rsync):\/\/[^\s"<>]+\.(?:zip|apk)'
Find pdf files in a folder recursive
rg -. --files -g  '*.pdf'
rg --hidden --files -g  '*.pdf'
Find all files recursive but avoid all pdf files
rg -. --files -g  '!*.pdf'   
List directories
rg --hidden \
   --sort-files \
   --files \
   --null 2> /dev/null \
   | xargs -0 dirname \
   | uniq

Very fast history search with ripgrep

rh() { rg "$1" ~/.bash_history }

List matching files only

rg -l clap  

Files Without a Match

rg --files-without-match '\b(var|let|const)\b'

Use -v to filter out all matches so that only non-matches are left.

rg 'bar' | rg -v 'foobar'

Displays built-in available types and their corresponding globs

rg --type-list  

Only search in .sh files, -g can be used multiple times

rg -g '*.sh' clap  

Search in all files except .sh files, -g can be used multiple times

rg -g '!*.sh' clap 

The following command restricts the search for the pattern "key" to json files only.

rg key -t json

File separator

rg wuseman --field-match-separator ': Match -> '

Path separator

rg wuseman --path-separator '/'
rg --files
rg --type-list

Show the help message.

rg --help

Display the version of ripgrep.

rg --version

Use the PCRE2 regex engine.

rg --pcre2

Use a provided pattern for search (requires pattern argument).

rg --regexp

Show column numbers in results.

rg --column

Don't show column numbers in results.

rg --no-column

Ignore case for the pattern.

rg --ignore

Show NUM lines after each match (requires NUM argument).

rg --after-context

Show NUM lines before and after each match (requires NUM argument).

rg --context

Use the best regex engine for each pattern.

rg --auto-hybrid-regex

Specify regex engine to use (requires argument).

rg --engine

Search binary files.

rg --binary

Search only text files.

rg --text

Search all files, including hidden and binary.

rg --unrestricted

Don't search binary files.

rg --no-binary

Use block buffering, which can help speed up searches in large data sets.

rg --block-buffered

Disable block buffering.

rg --no-block-buffered

Use line buffering, useful when tailing a file.

rg --line-buffered
rg --byte-offset

Show only the part of a line matching the pattern.

rg --only-matching

Use a preprocessor command.

rg --pre

Make the pattern case sensitive.

rg --case-sensitive

Ignore case when matching the pattern.

rg --ignore-case

Configure coloring of output.

rg --color
rg --vimgrep

Configure colors used in output (requires argument).

rg --colors

Display the line numbers with output lines.

rg --line-number

Show NUM lines before each match (requires NUM argument).

rg --before-context

Set the string to print between every context line.

rg --context-separator

Do not print a separator between context lines.

rg --no-context-separator

Only print a count of matches per file.

rg --count

Enable matching across multiple lines.

rg --multiline

Of course, let's continue with the explanations:

rg --count-matches

Always print the file path with the matched lines.

rg --with-filename
rg --include-zero
rg --count-matches

Always print the file path with the matched lines.

rg --with-filename
rg --count

Treat CRLF ("rn") as a line terminator, instead of just "n".

rg --crlf

Never treat CRLF ("rn") as a line terminator.

rg --no-crlf

Show debug messages.

rg --debug

Show trace messages. This is more verbose than –debug.

rg --trace

Set the size limit of the DFA. Requires argument for size (e.g., –dfa-size-limit 1G).

rg --dfa-size-limit

Ignore files larger than SIZE. Requires argument for size (e.g., –max-filesize 1G).

rg --max-filesize

Specify the text encoding that ripgrep should use on all files searched. Requires argument for encoding type.

rg --encoding

Never perform encoding detection and instead search all files as if they were ASCII.

rg --no-encoding

Set the regular expression engine. (Requires argument, e.g., –engine pcre2 or –engine auto.)

rg --engine

Use a provided pattern for search. (Requires pattern argument.)

rg --regexp

Search for patterns from the given file. (Requires file argument.)

rg --file

Use the PCRE2 regex engine.

rg --pcre2

Set the field context separator. (Requires argument.)

rg --field-context-separator

Set the field match separator. (Requires argument.)

rg --field-match-separator

Search for patterns from the given file. (Requires file argument.)

rg --file

Here are the remaining commands and options with descriptions:

Use a provided pattern for search. (Requires pattern argument.)

rg --regexp

List all files that would be searched without actually performing the search.

rg --files
rg --files-with-matches
rg --files-without-match
rg --files-without-match
rg --files-with-matches
rg --files-with-matches

Treat the search pattern as a literal string instead of a regular expression.

rg --fixed-strings

Disable treating the search pattern as a literal string.

rg --no-fixed-strings
rg --follow
rg --no-follow

Only search files matching the given glob pattern.

rg --glob

Only search files matching the given glob pattern.

rg --glob

Perform case-insensitive matching for glob patterns.

rg --glob-case-insensitive

Only search files matching the given glob pattern.

rg --glob

Disable case-insensitive matching for glob patterns.

rg --no-glob-case-insensitive
rg --heading

Do not print the file name above each match.

rg --no-heading

Search hidden files and directories.

rg --hidden

Do not search hidden files and directories.

rg --no-hidden

Only search files matching the given glob pattern, case-insensitive.

rg --iglob

Ignore case when matching the pattern.

rg --ignore-case

Make the pattern case-sensitive.

rg --case-sensitive

Read patterns to ignore from the given file.

rg --ignore-file

Read patterns to ignore from the given file.

rg --ignore-file

Read case-insensitive patterns to ignore from the given file.

rg --ignore-file-case-insensitive

Do not read case-insensitive patterns to ignore from the given file.

rg --no-ignore-file-case-insensitive

Include zero length files in the search.

rg --include-zero

Only print a count of matches per file.

rg --count

Invert the match: show lines that do not match the pattern.

rg --invert-match

Output search results in JSON format.

rg --json

Disable outputting search results in JSON format.

rg --no-json

Enable line buffering of the output, useful for streaming or piping to other commands.

rg --line-buffered

Show line numbers in search results.

rg --line-number

Only match whole lines.

rg --line-regexp

Only match whole words.

rg --word-regexp

Certainly! Here are the explanations for the provided commands and options:

Set the maximum width of the output to N columns.

rg --max-columns
rg --max-columns-preview

Set the maximum width of the output to N columns.

rg --max-columns

Set the maximum width of the output to N columns.

rg --max-columns,

Disable previewing the maximum width of the output.

rg --no-max-columns-preview.

Limit the number of matches per file to N.

rg --max-count

Set the maximum directory depth for recursive search to N levels.

rg --max-depth

Set the maximum directory depth for recursive search to N levels.

rg --max-depth

Set the maximum size of files to search to N bytes.

rg --max-filesize

Set the maximum size of files to search to N bytes.

rg --max-filesize

Use memory-mapped I/O to search files.

rg --mmap

Set the number of context lines to display around each match.

rg --context

Use memory-mapped I/O to search files.

rg --mmap

Disable memory-mapped I/O for file searching.

rg --no-mmap.

Enable matching across multiple lines.

rg --multiline

Enable matching across multiple lines, treating the entire input as a single line.

rg --multiline-dotall

Enable matching across multiple lines.

rg --multiline

Disable matching across multiple lines.

rg --no-multiline

Enable matching across multiple lines, treating the entire input as a single line.

rg --multiline-dotall

Enable matching across multiple lines.

rg --multiline

Enable matching across multiple lines.

rg --multiline

Disable matching across multiple lines, treating the entire input as a single line.

rg --no-multiline-dotall.

Enable matching across multiple lines, treating the entire input as a single line.

rg --multiline-dotall

Enable matching across multiple lines.

rg --multiline

Enable matching across multiple lines.

rg --multiline

Disable matching across multiple lines, treating the entire input as a single line.

rg --no-multiline-dotall.

Do not read any configuration files.

rg --no-config

Do not display the file name with each matched line.

rg --no-filename

Always display the file name with each matched line.

rg --with-filename

Do not display the file name above each group of matches.

rg --no-heading

Do not display the file name above each group of matches.

rg --no-heading

Display the file name above each group of matches.

rg --heading

Do not respect ignore files.

rg --no-ignore

Do not respect ignore files that start with a dot.

rg --no-ignore-dot,

Do not respect ignore files that are part of a directory's .ignore file.

rg --no-ignore-files,

Do not respect ignore files.

rg --no-ignore

Search all files, including hidden and binary files.

rg --unrestricted.

Respect ignore files.

rg --ignore

Do not respect ignore files that start with a dot.

rg --no-ignore-dot

Search hidden files and directories.

rg --hidden

Respect ignore files that are part of a directory's .ignore file.

rg --ignore-dot

Do not respect ignore files that exclude patterns from the command-line.

rg --no-ignore-exclude

Respect ignore files that exclude patterns from the command-line.

rg --ignore-exclude

Do not respect ignore files that list files and directories to ignore.

rg --no-ignore-files

Read patterns to ignore from the given file.

rg --ignore-file

Read patterns to ignore from the given file.

rg --ignore-files

Do not respect global ignore files.

rg --no-ignore-global

Respect global ignore files.

rg --ignore-global

Do not respect ignore files that display warning messages.

rg --no-ignore-messages

Respect ignore files that display warning messages.

rg --ignore-messages

Do not respect ignore files that apply to parent directories.

rg --no-ignore-parent

Respect ignore files that apply to parent directories.

rg --ignore-parent

Do not respect ignore files in version control directories.

rg --no-ignore-vcs

Do not respect ignore files that apply to parent directories.

rg --no-ignore-parent

Respect ignore files in version control directories.

rg --ignore-vcs

Do not print line numbers with the search results.

rg --no-line-number

Do not display warning messages.

rg --no-messages

Display warning messages.

rg --messages

Disable memory-mapped I/O for file searching.

rg --no-mmap

Enable memory-mapped I/O for file searching.

rg --mmap.

Disable PCRE2 Unicode support.

rg --no-pcre2-unicode

Disable Unicode support.

rg --no-unicode

Disable Unicode support.

rg --no-unicode.

Require that the search is performed in a Git repository.

rg --no-require-git

Require that the search is performed in a Git repository.

rg --require-git.

Disable Unicode support.

rg --no-unicode

Disable Unicode support.

rg --no-unicode

Do not perform automatic text encoding detection.

rg --no-encoding

Disable Unicode support.

rg --no-unicode

Use null bytes ('0') as line terminators.

rg --null

Only print the count of matches per file.

rg --count,

Use null bytes ('0') as input and output field separators.

rg --null-data

Use null bytes ('0') as line terminators.

rg --null

Search only text files.

rg --text.

Do not cross file system boundaries.

rg --one-file-system

Do not cross file system boundaries.

rg --one-file-system

Do not cross file system boundaries.

rg --no-one-file-system.

Only print the matched portion of the line.

rg --only-matching

Pass through all data without filtering.

rg --passthru

Show additional lines of context around each match.

rg --context,

Set the separator for paths in the output.

rg --path-separator

Use the PCRE2 regex engine.

rg --pcre2

Enable matching across multiple lines.

rg --multiline

Disable PCRE2 Unicode support.

rg --no-pcre2-unicode

Disable PCRE2 regex engine support.

rg --no-pcre2.

Show the PCRE2 version used by ripgrep.

rg --pcre2-version

Use a preprocessor command.

rg --pre

Do not use a preprocessor command.

rg --no-pre

Use the given shell glob to determine files to ignore.

rg --pre-glob'

Search inside compressed files (e.g., zip, gzip).

rg --search-zip

Use the given shell glob to determine files to ignore.

rg --pre-glob

Use a preprocessor command.

rg --pre

Use a preprocessor command.

rg --pre

Use a preprocessor command.

rg --pre

Use a preprocessor command.

rg --pre

Use the given shell glob to determine files to ignore.

rg --pre-glob

Use a preprocessor command.

rg --pre

Enable prettified output for JSON search results.

rg --pretty

Enable or disable colored output.

rg --color

Suppress all error messages.

rg --quiet

List all files that would be searched without actually performing the search.

rg --files

Set the maximum size of the regex pattern to N bytes.

rg --regex-size-limit

Set the maximum size of files to search to N bytes.

rg --max-filesize

Use a provided pattern for search. (Requires pattern argument.)

rg --regexp

Search for an empty pattern (matches all lines).

rg --

Replace each match with the given replacement.

rg --replace

Only print the matched portion of the line.

rg --only-matching

Search inside compressed files (e.g., zip, gzip).

rg --search-zip

Disable searching inside compressed files.

rg --no-search-zip.

Enable smart case matching (case-insensitive when the pattern is lowercase).

rg --smart-case

Make the search case-sensitive.

rg --case-sensitive

Sort files by relevance.

rg --sort

Sort files by relevance in reverse order.

rg --sortr

Sort files by relevance in reverse order.

rg --sortr

Sort files by relevance.

rg --sort

Show statistics after search is complete.

rg --stats

List all files that would be searched without actually performing the search.

rg --files,

Disable displaying search statistics.

rg --no-stats.

Search only text files.

rg --text

Search both binary and text files.

rg --binary

Disable searching text files.

rg --no-text.

Set the number of threads to use for searching.

rg --threads

Trim leading and trailing whitespace from each line.

rg --trim

Disable trimming leading and trailing whitespace from each line.

rg --no-trim.

Specify the file type(s) to search. (Requires type argument.)

rg --type

List all available file types and their corresponding globs.

rg --type-list

Specify the file type(s) to search. (Requires type argument.)

rg --type

Specify the file type(s) to search. (Requires type argument.)

rg --type

Add a new file type with associated globs.

rg --type-add

Add a new file type with associated globs.

rg --type-add

Add a new file type with associated globs.

rg --type-add

Add a new file type with associated globs.

rg --type-add

Add a new file type with associated globs.

rg --type-add

Add a new file type with associated globs.

rg --type-add

Add a new file type with associated globs.

rg --type-add

Clear all file type definitions.

rg --type-clear

List all available file types and their corresponding globs.

rg --type-list

Exclude the given file type(s) from the search. (Requires type argument.)

rg --type-not

List all available file types and their corresponding globs.

rg --type-list

Search all files, including hidden and binary files.

rg --unrestricted

Do not respect ignore files.

rg --no-ignore).

Search hidden files and directories.

rg --hidden).

Output the search results in Vim-compatible format.

rg --vimgrep

Always display the file name with each matched line.

rg --with-filename

Display the file name above each group of matches.

rg --heading

Do not display the file name with each matched line.

rg --no-filename.

Only match whole words.

rg --word-regexp

Only match whole lines.

rg --line-regexp

Suppress all error messages.

rg --quiet

Suppress all error messages.

rg --quiet

Read patterns to ignore from the given file.

rg --ignore-file

Read patterns to ignore from the given file.

rg --ignore-file.

Do not respect ignore files.

rg --no-ignore

Search hidden files and directories.

rg --hidden

Search both binary and text files.

rg --binary
rg --follow

Do not respect ignore files.

rg --no-ignore.

Do not respect ignore files.

rg --no-ignore

Do not respect ignore files.

rg --no-ignore

Use a provided pattern for search. (Requires pattern argument.)

rg --regexp

Enable smart case matching (case-insensitive when the pattern is lowercase).

rg --smart-case

Enable smart case matching (case-insensitive when the pattern is lowercase).

rg --smart-case

Add a new file type with associated globs.

rg --type-add

Add a new file type with associated globs.

rg --type-add

Search for files that do not match the given glob pattern.

rg --glob=!.git

Search for files that match the given glob pattern.

rg --glob

Search for files that match the given glob pattern.

rg --glob

Disable reading configuration files.

rg --no-config,

Make the search case-sensitive.

rg --case-sensitive

Enable smart case matching (case-insensitive when the pattern is lowercase).

rg --smart-case

Make the search case-sensitive.

rg --case-sensitive

Disable memory-mapped I/O for file searching.

rg --no-mmap

Enable debug mode, printing detailed debug information.

rg --debug

Color Examples

Match with background color (105, 64, 130) in purple:

rg -i --colors 'match:bg:105,64,130'

Match with underline style:

rg -i --colors 'match:style:underline'

Match with bold style and background color (128, 0, 0) in red:

rg -i --colors 'match:bg:128,0,0' --colors 'match:style:bold'

Match without bold style and background color (0, 128, 0) in green:

rg -i --colors 'match:bg:0,128,0' --colors 'match:style:nobold'

Match with intense (bright) background color (0, 0, 255) in blue:

rg -i --colors 'match:bg:0,0,255' --colors 'match:style:intense'

Match without intense (bright) background color (255, 255, 0) in yellow:

rg -i --colors 'match:bg:255,255,0' --colors 'match:style:nointense'

Match with background color (255, 0, 255) in magenta and underline style:

rg -i --colors 'match:bg:255,0,255' --colors 'match:style:underline'

Match with background color (0, 255, 255) in cyan without underline style:

rg -i --colors 'match:bg:0,255,255' --colors 'match:style:nounderline'

Match with background color (255, 165, 0) in orange and line with foreground color (255, 255, 255) in white:

rg -i --colors 'match:bg:255,165,0' --colors 'line:fg:255,255,255'

Match with background color (128, 0, 0) in red and line with foreground color (0, 255, 0) in green:

rg -i --colors 'match:bg:128,0,0' --colors 'line:fg:0,255,0'

Match with background color (0, 128, 0) in green and line with foreground color (0, 0, 255) in blue:

rg -i --colors 'match:bg:0,128,0' --colors 'line:fg:0,0,255'

Match with background color (0, 0, 128) in blue and line with foreground color (255, 0, 255) in magenta:

rg -i --colors 'match:bg:0,0,128' --colors 'line:fg:255,0,255'

Match with background color (128, 128, 128) in gray and line with foreground color (255, 255, 0) in yellow:

rg -i --colors 'match:bg:128,128,128' --colors 'line:fg:255,255,0'

Match with background color (

0, 128, 128) in teal and line with foreground color (255, 0, 0) in red:

rg -i --colors 'match:bg:0,128,128' --colors 'line:fg:255,0,0'

Match with background color (128, 0, 128) in purple and line with foreground color (0, 255, 0) in green:

rg -i --colors 'match:bg:128,0,128' --colors 'line:fg:0,255,0'

Match with background color (255, 0, 0) in red and line with foreground color (0, 0, 255) in blue:

rg -i --colors 'match:bg:255,0,0' --colors 'line:fg:0,0,255'

Match with background color (0, 255, 0) in green and line with foreground color (255, 255, 255) in white:

rg -i --colors 'match:bg:0,255,0' --colors 'line:fg:255,255,255'

Match with background color (0, 0, 255) in blue and line with foreground color (255, 0, 255) in magenta:

rg -i --colors 'match:bg:0,0,255' --colors 'line:fg:255,0,255'

Match with background color (0, 255, 255) in cyan and line with foreground color (128, 0, 0) in maroon:

rg -i --colors 'match:bg:0,255,255' --colors 'line:fg:128,0,0'

Match with background color (255, 0, 255) in magenta and line with foreground color (0, 128, 0) in dark green:

rg -i --colors 'match:bg:255,0,255' --colors 'line:fg:0,128,0'

Match with background color (255, 255, 0) in yellow and line with foreground color (0, 0, 128) in navy:

rg -i --colors 'match:bg:255,255,0' --colors 'line:fg:0,0,128'

Match with background color (255, 0, 0) in red and line with foreground color (128, 0, 128) in purple:

rg -i --colors 'match:bg:255,0,0' --colors 'line:fg:128,0,128'

Match with background color (0, 255, 0) in green and line with foreground color (0, 128, 0) in olive:

rg -i --colors 'match:bg:0,255,0' --colors 'line:fg:0,128,0'

Match with background color (0, 0, 255) in blue and line with foreground color (128, 0, 128) in purple:

rg -i --colors 'match:bg:0,0,255' --colors 'line:fg:128,0,128'

Match with background color (128, 128, 128) in gray and line with foreground color (0, 128, 128) in teal:

rg -i --colors 'match:bg:128,128,128' --colors 'line:fg:0,128,128'

Match with background color (0, 128, 128) in teal and line with foreground color (128, 128, 128) in gray:

rg -i --colors 'match:bg:0,128,128' --colors 'line:fg:128,128,128'

Match with background color (128, 0, 128) in purple and line with foreground color (128, 0, 0) in red:

rg -i --colors 'match:bg:128,0,128' --colors 'line:fg:128,0,0'

Match with background color (255, 0, 0) in red and line with foreground color (128, 0, 128) in purple:

rg -i --colors 'match:bg:255,0,0' --colors 'line:fg:128,0,128'

Match with background color (0, 255, 0) in green and line with foreground color (0, 128, 0) in dark green:

rg -i --colors 'match:bg:0,255,0' --colors 'line:fg:0,128,0'

Match with background color (0, 0, 255) in blue and line with foreground color (0, 0, 128) in navy:

rg -i --colors 'match:bg:0,0,255' --colors 'line:fg:0,0,128'

Match with background color (128, 128, 0) in olive and line with foreground color (128, 0, 0) in maroon:

rg -i --colors 'match:bg:128,128,0' --colors 'line:fg:128,0,0'

Match with background color (128, 0, 128) in purple and line with foreground color (0, 128, 0) in green:

rg -i --colors 'match:bg:128,0,128' --colors 'line:fg:0,128,0'

Match with background color (0, 128, 128) in teal and line with foreground color (0, 128, 128) in teal:

rg -i --colors 'match:bg:0,128,128' --colors 'line:fg:0,128,128'

Match with background color (255, 0, 0) in red and line with foreground color (128, 128, 0) in olive:

rg -i --colors 'match:bg:255,0,0' --colors 'line:fg:128,128,0'

Match with background color (0, 255, 0) in green and line with foreground color (128, 0, 128) in purple:

rg -i --colors 'match:bg:0,255,0' --colors 'line:fg:128,0,128'

Match with background color (0, 0, 255) in blue and line with foreground color (128, 128, 128) in gray:

rg -i --colors 'match:bg:0,0,255' --colors 'line:fg:128,128,128'

Match with background color (128, 128, 128) in gray and line with foreground color (0, 255, 0) in green:

rg -i --colors 'match:bg:128,128,128' --colors 'line:fg:0,255,0'

Match with background color (0, 128, 128) in teal and line with foreground color (0, 0, 255) in blue:

rg -i --colors 'match:bg:0,128,128' --colors 'line:fg:0,0,255'

Match with background color (128, 0, 128) in purple and line with foreground color (128, 0, 0) in red:

rg -i --colors 'match:bg:128,0,128' --colors 'line:fg:128,0,0'

Match with background color (255, 0, 0) in red and line with foreground color (0, 0, 128) in navy:

rg -i --colors 'match:bg:255,0,0' --colors 'line:fg:0,0,128'

Match with background color (0, 255, 0) in green and line with foreground color (0, 128, 128) in teal:

rg -i --colors 'match:bg:0,255,0' --colors 'line:fg:0,128,128'

Match with background color (0, 0, 255) in blue and line with foreground color (255, 0, 0) in red:

rg -i --colors 'match:bg:0,0,255' --colors 'line:fg:255,0,0'

Match with background color (128, 128, 0) in olive and line with foreground color (128, 128, 0) in olive:

rg -i --colors 'match:bg:128,128,0' --colors 'line:fg:128,128,0'

Match with background color (128, 0, 128) in purple and line with foreground color (0, 255, 0) in green:

rg -i --colors 'match:bg:128,0,128' --colors 'line:fg:0,255,0'

Match with background color (0, 128, 128) in teal and line with foreground color (0, 0, 255) in blue:

rg -i --colors 'match:bg:0,128,128' --colors 'line:fg:0,0,255'

Match with background color (255, 0, 0) in red and line with foreground color (0, 255, 0) in green:

rg -i --colors 'match:bg:255,0,0' --colors 'line:fg:0,255,0'

Match with background color (0, 255, 0) in green and line with foreground color (128, 0, 128) in purple:

rg -i --colors 'match:bg:0,255,0' --colors 'line:fg:128,0,128'

Match with background color (0, 0, 255) in blue and line with foreground color (0, 128, 128) in teal:

rg -i --colors 'match:bg:0,0,255' --colors 'line:fg:0,128,128'

Match with background color (128, 128, 128) in gray and line with foreground color (255, 0, 0) in red:

rg -i --colors 'match:bg:128,128,128' --colors 'line:fg:255,0,0'

Match with background color (0, 128, 128) in teal and line with foreground color (0, 255, 0) in green:

rg -i --colors 'match:bg:0,128,128' --colors 'line:fg:0,255,0'

Match with background color (128, 0, 0) in red and line with foreground color (128, 128, 0) in olive:

rg -i --colors 'match:bg:128,0,0' --colors 'line:fg:128,128,0'

Match with background color (0, 128, 0) in green and line with foreground color (0, 128, 128) in teal:

rg -i --colors 'match:bg:0,128,0' --colors 'line:fg:0,128,128'

Match with background color (0, 0, 128) in blue and line with foreground color (128, 0, 128) in purple:

rg -i --colors 'match:bg:0,0,128' --colors 'line:fg:128,0,128'

Match with background color (255, 255, 0) in yellow and line with foreground color (0, 255, 255) in cyan:

rg -i --colors 'match:bg:255,255,0' --colors 'line:fg:0,255,255'

Match with background color (255, 0, 255) in magenta and line with foreground color (255, 0, 255) in magenta:

rg -i --colors 'match:bg:255,0,255' --colors 'line:fg:255,0,255'