summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>2015-08-09 13:49:40 +0900
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2015-08-12 08:04:30 +0900
commit3ffc6b3b4fe49a9c099a36191a0846aceef1adfc (patch)
tree9fb2f6ddeba5d3070ab77986fa5d91a795c6888e
parent3cd37dc88f178776efadac622546d9ee738225d8 (diff)
bgp: use regexp.FindStringSubmatch() insead of regexp.FindSubMatch()
Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
-rw-r--r--packet/bgp.go8
1 files changed, 2 insertions, 6 deletions
diff --git a/packet/bgp.go b/packet/bgp.go
index c3f43bdb..2f246951 100644
--- a/packet/bgp.go
+++ b/packet/bgp.go
@@ -863,14 +863,10 @@ func GetRouteDistinguisher(data []byte) RouteDistinguisherInterface {
func parseRdAndRt(input string) ([]string, error) {
exp := regexp.MustCompile("^((\\d+)\\.(\\d+)\\.(\\d+)\\.(\\d+)|((\\d+)\\.)?(\\d+)):(\\d+)$")
- group := exp.FindSubmatch([]byte(input))
- if len(group) != 10 {
+ elems := exp.FindStringSubmatch(input)
+ if len(elems) != 10 {
return nil, fmt.Errorf("failed to parse")
}
- elems := make([]string, 0, len(group))
- for _, elem := range group {
- elems = append(elems, string(elem))
- }
return elems, nil
}