From 639cd00721c4b48b4b19e699206f9c59dae53779 Mon Sep 17 00:00:00 2001 From: Cyril Tovena Date: Tue, 5 Oct 2021 15:59:40 +0200 Subject: [PATCH] Uses the variadic function. Signed-off-by: Cyril Tovena --- pkg/labels/regexp.go | 4 +--- pkg/labels/regexp_test.go | 1 + 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/pkg/labels/regexp.go b/pkg/labels/regexp.go index 6c8a131011..705d8cc5f4 100644 --- a/pkg/labels/regexp.go +++ b/pkg/labels/regexp.go @@ -115,9 +115,7 @@ func findSetMatchesFromConcat(re *syntax.Regexp, base string) []string { if len(re.Sub) == 0 { return nil } - for _, sub := range re.Sub { - clearCapture(sub) - } + clearCapture(re.Sub...) matches := findSetMatches(re.Sub[0], base) if matches == nil { return nil diff --git a/pkg/labels/regexp_test.go b/pkg/labels/regexp_test.go index 2dba236710..abaa6b5d3f 100644 --- a/pkg/labels/regexp_test.go +++ b/pkg/labels/regexp_test.go @@ -116,6 +116,7 @@ func TestFindSetMatches(t *testing.T) { {"bar|b|buzz", []string{"bar", "b", "buzz"}}, // Simple sets containing escaped characters. {"fo\\.o|bar\\?|\\^baz", []string{"fo.o", "bar?", "^baz"}}, + // using charclass {"[abc]d", []string{"ad", "bd", "cd"}}, // high low charset different => A(B[CD]|EF)|BC[XY] {"ABC|ABD|AEF|BCX|BCY", []string{"ABC", "ABD", "AEF", "BCX", "BCY"}},