Open vanderhoffs opened 5 years ago
here is the go code i used
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 }
Hi there. Could you please to test it against feature/v0.3 branch?
@gobwas are you plan to release soon?
@AlmogBaku I am planning, yes. Do you have same problems? Could you try it over feature/v0.3?
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?