mirror of
https://github.com/osrg/gobgp.git
synced 2024-05-11 05:55:10 +00:00
Revert "policy: remove unnecessary regexp special charactor"
This reverts commit 76525a966b.
This commit is contained in:
committed by
FUJITA Tomonori
parent
e06bb04f14
commit
b7543a5ae0
+3
-3
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user