summaryrefslogtreecommitdiffhomepage
path: root/table/policy.go
diff options
context:
space:
mode:
authortamihiro <dead6oy@gmail.com>2016-04-20 11:33:54 +0900
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2016-04-20 12:19:35 +0900
commitb7543a5ae05e41597b136fa4fc0cbd74ac99c345 (patch)
tree4541e6a6fe39eee8e83e2963858efd58172ed3ad /table/policy.go
parente06bb04f14bc24eddf24e40aa340a8a05a99c637 (diff)
Revert "policy: remove unnecessary regexp special charactor"
This reverts commit 76525a966bdfdfd10195e72fffcffbc3a6c69d78.
Diffstat (limited to 'table/policy.go')
-rw-r--r--table/policy.go6
1 files changed, 3 insertions, 3 deletions
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)