mirror of
https://github.com/BurntSushi/ripgrep.git
synced 2024-12-12 19:18:24 +02:00
doc: clarify how -S/--smart-case works
Whether or not smart case kicks in can be a little subtle in some cases. So we document the specific conditions in which it applies. These conditions were taken directly from the public API docs of the `grep-regex` crate: https://docs.rs/grep-regex/0.1.8/grep_regex/struct.RegexMatcherBuilder.html#method.case_smart Fixes #1708
This commit is contained in:
parent
6301e20ee4
commit
2b1637d1db
@ -2634,6 +2634,15 @@ fn flag_smart_case(args: &mut Vec<RGArg>) {
|
||||
Searches case insensitively if the pattern is all lowercase. Search case
|
||||
sensitively otherwise.
|
||||
|
||||
A pattern is considered all lowercase if both of the following rules hold:
|
||||
|
||||
First, the pattern contains at least one literal character. For example, 'a\\w'
|
||||
contains a literal ('a') but just '\\w' does not.
|
||||
|
||||
Second, of the literals in the pattern, none of them are considered to be
|
||||
uppercase according to Unicode. For example, 'foo\\pL' has no uppercase
|
||||
literals but 'Foo\\pL' does.
|
||||
|
||||
This overrides the -s/--case-sensitive and -i/--ignore-case flags.
|
||||
"
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user