-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Closed
Labels
bugA bug.A bug.
Description
What version of ripgrep are you using?
13.0.0
How did you install ripgrep?
brew
What operating system are you using ripgrep on?
MacOS M1
Describe your bug.
When providing multiple patterns via either -e or -f,
specified flags affect all following patterns.
What are the steps to reproduce the behavior?
Text
What is the actual behavior?
rg respect the case-insensitive flag (?i) from the first pattern in the second pattern as well.
DEBUG|globset|crates/globset/src/lib.rs:421: built glob set; 0 literals, 0 basenames, 12 extensions, 0 prefixes, 0 suffixes, 0 required extensions, 0 regexes
Text
Same goes for:
echo 'MyText' | rg -f <(printf '(?i)notintext\ntext')
What is the expected behavior?
Empty result (the case-insensitive flag should not affect the second pattern).
What do you think ripgrep should have done?
Treat each pattern independently.
Specifically, for these pattern, I'd expect the merged pattern to be:
'(?:(?i)notintext')|(?:'text')
rather than:
'(?i)notintext'|'text'
Side notes:
- Works as expected if I manually wrap each pattern as
(?:PATTERN) - Works as expected if I replace the first pattern with
(?i:notintext) - Works as expected if I replace the order of the patterns (because the effect of the flag only applies "to the right")
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugA bug.A bug.