File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed
libs/core/src/main/java/org/elasticsearch/core Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -36,14 +36,20 @@ public static boolean globMatch(String pattern, String str) {
3636 return pattern .equals (str );
3737 }
3838
39- // If the pattern is a literal '*' then it matches any input
4039 if (patternIndex == 0 ) {
40+ // If the pattern is a literal '*' then it matches any input
4141 if (pattern .length () == 1 ) {
4242 return true ;
4343 }
44- } else if (str .regionMatches (0 , pattern , 0 , patternIndex ) == false ) {
45- // If the pattern starts with a literal (i.e. not '*') then the input string must also start with that
46- return false ;
44+ } else {
45+ if (str .regionMatches (0 , pattern , 0 , patternIndex ) == false ) {
46+ // If the pattern starts with a literal (i.e. not '*') then the input string must also start with that
47+ return false ;
48+ }
49+ if (patternIndex == pattern .length () - 1 ) {
50+ // The pattern is "something*", so if the starting region matches, then the whole pattern matches
51+ return true ;
52+ }
4753 }
4854
4955 int strIndex = patternIndex ;
You can’t perform that action at this time.
0 commit comments