-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
improve --smart-case once and for all #851
Copy link
Copy link
Closed
Labels
enhancementAn enhancement to the functionality of the software.An enhancement to the functionality of the software.libripgrepAn issue related to modularizing ripgrep into libraries.An issue related to modularizing ripgrep into libraries.
Milestone
Description
We should improve the --smart-case flag to be perfect or nearly perfect at least. The regex-syntax crate rewrite now has a more detailed AST, which permits us to handle cases like [A-Z] and \p{Ll} differently. In particular, I propose:
When the --smart-case flag is given, ripgrep chooses to match case insensitively if and only if there is at least one literal character in the pattern and that all such literals are not considered as uppercase. If the pattern contains no literals or at least one uppercase literal character, then normal case sensitive search is used.
Examples: abc, [a-z], abc\w and abc\p{Ll} are all searched case insensitively while aBc, [A-Z], aBc\w and \p{Ll} are searched case sensitively.
See also: #717 (comment)
cc @okdana
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementAn enhancement to the functionality of the software.An enhancement to the functionality of the software.libripgrepAn issue related to modularizing ripgrep into libraries.An issue related to modularizing ripgrep into libraries.