improve --smart-case once and for all #851
Labels
enhancement
An enhancement to the functionality of the software.
libripgrep
An issue related to modularizing ripgrep into libraries.
Milestone
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
andabc\p{Ll}
are all searched case insensitively whileaBc
,[A-Z]
,aBc\w
and\p{Ll}
are searched case sensitively.See also: #717 (comment)
cc @okdana
The text was updated successfully, but these errors were encountered: