Whitelist only certain binary files #2504
-
I have several config files which contain a NUL byte at the end and are therefore considered binary by rg. Is it possible to whitelist these files, so they are searched without enabling search for all the binary files? I tried adding file names as |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
No, there is no way to do this unfortunately. The way binary file filtering is handled is a bit distinct from other types of filtering because binary file filtering is fundamentally different. It requires actually attempting to read the contents of the file to determine whether it's binary or not. And even then, the concept of "binary" is itself a heuristic. One possibility is to just use |
Beta Was this translation helpful? Give feedback.
No, there is no way to do this unfortunately. The way binary file filtering is handled is a bit distinct from other types of filtering because binary file filtering is fundamentally different. It requires actually attempting to read the contents of the file to determine whether it's binary or not. And even then, the concept of "binary" is itself a heuristic.
One possibility is to just use
--binary
or even-a/--text
and then blacklist other binary files. Probably not a great solution in general, but it might work well enough in some cases.