You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
gives the expected results
Match List [test.20190101.120000 test.20190101.130000 test.20190101.140000] to Patterns [test.201901.12* test.201901.14*]
Match Item test.20190101.120000 to Patterns [test.201901.12* test.201901.14*] true
Match Item test.20190101.130000 to Patterns [test.201901.12* test.201901.14*] false
Match Item test.20190101.140000 to Patterns [test.201901.12* test.201901.14*] true
but If I change the pattern to (see the first pattern in the list - I took out the first ".")
sourceList := []string{"test.20190101.120000", "test.20190101.130000", "test.20190101.140000"}
patternList := []string{"test201901.12*", "test.201901.14*"}
I get the unexpected results - nothing matches!
Match List [test.20190101.120000 test.20190101.130000 test.20190101.140000] to Patterns [test201901.12* test.201901.14*]
Match Item test.20190101.120000 to Patterns[test201901.12* test.201901.14*] false
Match Item test.20190101.130000 to Patterns [test201901.12* test.201901.14*] false
Match Item test.20190101.140000 to Patterns [test201901.12* test.201901.14*] false
If it is a problem with the pattern, I could see the first source entry not matching but expected the third source entry to match as in the first test as it is the same.
Am I misunderstanding the use of a pattern array?
The text was updated successfully, but these errors were encountered:
func findMatches(sl, pl []string) (ml []string) {
gp := "{" + strings.Join(pl, ",") + "}"
g := glob.MustCompile(gp)
Log.Infof("Match List %s to Patterns %s", sl, pl)
for _, s := range sl {
m := g.Match(s)
if m {
ml = append(ml, s)
}
Log.Infof("Match Item %s to Patterns %s %v", s, pl, m)
}
return ml
}
I am trying to match a source array to a pattern array (I process the source list one item at a time)
sourceList := []string{"test.20190101.120000", "test.20190101.130000", "test.20190101.140000"}
patternList := []string{"test.201901.12*", "test.201901.14*"}
gives the expected results
Match List [test.20190101.120000 test.20190101.130000 test.20190101.140000] to Patterns [test.201901.12* test.201901.14*]
Match Item test.20190101.120000 to Patterns [test.201901.12* test.201901.14*] true
Match Item test.20190101.130000 to Patterns [test.201901.12* test.201901.14*] false
Match Item test.20190101.140000 to Patterns [test.201901.12* test.201901.14*] true
but If I change the pattern to (see the first pattern in the list - I took out the first ".")
sourceList := []string{"test.20190101.120000", "test.20190101.130000", "test.20190101.140000"}
patternList := []string{"test201901.12*", "test.201901.14*"}
I get the unexpected results - nothing matches!
Match List [test.20190101.120000 test.20190101.130000 test.20190101.140000] to Patterns [test201901.12* test.201901.14*]
Match Item test.20190101.120000 to Patterns[test201901.12* test.201901.14*] false
Match Item test.20190101.130000 to Patterns [test201901.12* test.201901.14*] false
Match Item test.20190101.140000 to Patterns [test201901.12* test.201901.14*] false
If it is a problem with the pattern, I could see the first source entry not matching but expected the third source entry to match as in the first test as it is the same.
Am I misunderstanding the use of a pattern array?
The text was updated successfully, but these errors were encountered: