phiresky / ripgrep-all

rga: ripgrep, but also search in PDFs, E-Books, Office documents, zip, tar.gz, etc.
Other
8.21k stars 177 forks source link

Feature Request: Boolean match for muliple pattern #93

Closed wwzhang closed 3 years ago

wwzhang commented 3 years ago

As version:0.9.6 on Brew, the patternfile seems only do OR search for the patterns. Could be possible to use boolean operators for the patterns?

Or could someone help me to do AND operations for two patterns?

phiresky commented 3 years ago

Your question is kind of underspecified. Do you mean matching multiple patterns in each line? Or generally matching files that contain both patterns? In any case, there is no simple way for either of these in a single command. You can use a pipeline to successively filter your results list down with multiple rga invocations. But since rga does not change the behaviour of regex matching in any way this is an issue for upstream ripgrep. There's open discussions e.g. here: https://github.com/BurntSushi/ripgrep/issues/875

wwzhang commented 3 years ago

Got it. Thanks.