diff options
author | ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp> | 2016-02-19 15:53:05 +0900 |
---|---|---|
committer | ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp> | 2016-02-19 15:53:05 +0900 |
commit | 76525a966bdfdfd10195e72fffcffbc3a6c69d78 (patch) | |
tree | 1a95c95b3c56dfc2f4d42eb1704f4500ddd1a5a4 /table | |
parent | 646860e9d12e139fc122ec421fc459fa59765c0e (diff) |
policy: remove unnecessary regexp special charactor
Since communities/ext-communities are tested one by one in policy-condition,
we don't need '^' and '$' around match condition items.
Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
Diffstat (limited to 'table')
-rw-r--r-- | table/policy.go | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/table/policy.go b/table/policy.go index 68792a6c..20ae16cd 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) |