From b7543a5ae05e41597b136fa4fc0cbd74ac99c345 Mon Sep 17 00:00:00 2001 From: tamihiro Date: Wed, 20 Apr 2016 11:33:54 +0900 Subject: Revert "policy: remove unnecessary regexp special charactor" This reverts commit 76525a966bdfdfd10195e72fffcffbc3a6c69d78. --- table/policy.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'table') diff --git a/table/policy.go b/table/policy.go index 8a174284..424a8562 100644 --- a/table/policy.go +++ b/table/policy.go @@ -879,14 +879,14 @@ func ParseExtCommunity(arg string) (bgp.ExtendedCommunityInterface, error) { func ParseCommunityRegexp(arg string) (*regexp.Regexp, error) { i, err := strconv.Atoi(arg) if err == nil { - return regexp.MustCompile(fmt.Sprintf("%d:%d", i>>16, i&0x0000ffff)), nil + return regexp.MustCompile(fmt.Sprintf("^%d:%d$", i>>16, i&0x0000ffff)), nil } if regexp.MustCompile("(\\d+.)*\\d+:\\d+").MatchString(arg) { - return regexp.MustCompile(fmt.Sprintf("%s", arg)), nil + return regexp.MustCompile(fmt.Sprintf("^%s$", arg)), nil } for i, v := range bgp.WellKnownCommunityNameMap { if strings.Replace(strings.ToLower(arg), "_", "-", -1) == v { - return regexp.MustCompile(fmt.Sprintf("%d:%d", i>>16, i&0x0000ffff)), nil + return regexp.MustCompile(fmt.Sprintf("^%d:%d$", i>>16, i&0x0000ffff)), nil } } exp, err := regexp.Compile(arg) -- cgit v1.2.3