Escape regexp metacharacters when converting globs to regexps - #174
Open
Wilfred wants to merge 1 commit into
Open
Escape regexp metacharacters when converting globs to regexps#174Wilfred wants to merge 1 commit into
Wilfred wants to merge 1 commit into
Conversation
deadgrep--glob-regexp copied literal glob characters into the elisp regexp verbatim, so a glob containing regexp metacharacters matched the wrong files: *.h++ matched foo.h and foo.hh but not foo.h++. This could make deadgrep--relevant-file-type suggest the wrong default file type. Quote literal characters with regexp-quote. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MwUBSSJnCtCeoqJEA3xH48
Wilfred
force-pushed
the
claude/fix-glob-regexp-metachars
branch
from
August 18, 2026 21:31
b1ac999 to
52d1dcf
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
deadgrep--glob-regexpcopied literal glob characters into the elisp regexp verbatim, so a glob containing regexp metacharacters matched the wrong files:*.h++produced^.*\.h++$, which matchesfoo.handfoo.hhbut notfoo.h++. Since this function backsdeadgrep--relevant-file-type, it could make deadgrep suggest the wrong default file type.Literal characters are now passed through
regexp-quote. Existing glob metacharacter handling (*,?,.,[...]) is unchanged and still covered by the existing tests; new tests cover the metacharacter case.(Current ripgrep's
--type-listhappens to contain no globs with regexp metacharacters, so this is mostly a latent bug — but older rg versions and user-defined types can hit it.)🤖 Generated with Claude Code
https://claude.ai/code/session_01MwUBSSJnCtCeoqJEA3xH48