Skip to content

how to search only for files with a specific extension OR no extension at all? #2355

Answered by BurntSushi
luckman212 asked this question in Q&A
Discussion options

You must be logged in to vote

The answer is in the --debug output. It can be a little difficult to parse as it is mostly there to aide programmers, but all you need to do is look for the files you want to search:

$ rg foo -g '*.py' -g '!*.*' --debug 2>&1 | rg foo
DEBUG|rg::args|crates/core/args.rs:543: final argv: ["rg", "--max-columns-preview", "--colors=match:bg:0xff,0x7f,0x00", "--colors=match:fg:white", "--colors=line:none", "--colors=line:fg:magenta", "--colors=path:fg:green", "--type-add=got:*_test.go", "foo", "-g", "*.py", "-g", "!*.*", "--debug"]
DEBUG|grep_regex::literal|crates/regex/src/literal.rs:58: literal prefixes detected: Literals { lits: [Complete(foo)], limit_size: 250, limit_class: 10 }
DEBUG|ignore…

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
1 reply
@luckman212
Comment options

Answer selected by luckman212
Comment options

You must be logged in to vote
2 replies
@BurntSushi
Comment options

@luckman212
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #2354 on November 20, 2022 17:24.