#3533·ripgrep

A flag for words that might be on different lines

Author: lumynou5Created Sep 14, 2026Updated Sep 14, 2026

Describe your feature request

This proposes two new flags: --wrapped-words and --wrapped-chars. They can't be used together. Both must be used with -F (--fixed-strings).

They are for CLI convenience in a very common scenario: you want to search for a phrase, and the target files have line wrapping. Usually, you need to use \s+ between words in order to match newlines and potential indents. With the new flags, you can do

rg -F --wrapped-words 'the brown dog jumped over the lazy fox'

which is the same as

rg -U 'the\s+brown\s+dog\s+jumped\s+over\s+the\s+lazy\s+fox'

but makes life easier.

--wrapped-chars behaves similarly except it inserts \s+ between each character instead of replacing space characters. It's mainly for scripts not using spaces, e.g. CJK ideographic.

rg -F --wrapped-chars '雨一直下'

means

rg -U '雨\s+一\s+直\s+下'