-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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
Comments
BurntSushi
added a commit
that referenced
this issue
Mar 14, 2018
This commit removes the previous smart case detection logic and replaces it with detection based on the regex AST. This particular AST is a faithful representation of the concrete syntax, which lets us be very precise in how we handle it. Closes #851
BurntSushi
added a commit
that referenced
this issue
Mar 14, 2018
This commit removes the previous smart case detection logic and replaces it with detection based on the regex AST. This particular AST is a faithful representation of the concrete syntax, which lets us be very precise in how we handle it. Closes #851
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
enhancement
An enhancement to the functionality of the software.
libripgrep
An issue related to modularizing ripgrep into libraries.
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: