Skip to content

Commit 2b1637d

Browse files
committed
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
1 parent 6301e20 commit 2b1637d

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

‎crates/core/app.rs‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2634,6 +2634,15 @@ fn flag_smart_case(args: &mut Vec<RGArg>) {
26342634
Searches case insensitively if the pattern is all lowercase. Search case
26352635
sensitively otherwise.
26362636
2637+
A pattern is considered all lowercase if both of the following rules hold:
2638+
2639+
First, the pattern contains at least one literal character. For example, 'a\\w'
2640+
contains a literal ('a') but just '\\w' does not.
2641+
2642+
Second, of the literals in the pattern, none of them are considered to be
2643+
uppercase according to Unicode. For example, 'foo\\pL' has no uppercase
2644+
literals but 'Foo\\pL' does.
2645+
26372646
This overrides the -s/--case-sensitive and -i/--ignore-case flags.
26382647
"
26392648
);

0 commit comments

Comments
 (0)