diff options
author | ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp> | 2015-08-09 13:49:40 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2015-08-12 08:04:30 +0900 |
commit | 3ffc6b3b4fe49a9c099a36191a0846aceef1adfc (patch) | |
tree | 9fb2f6ddeba5d3070ab77986fa5d91a795c6888e /packet | |
parent | 3cd37dc88f178776efadac622546d9ee738225d8 (diff) |
bgp: use regexp.FindStringSubmatch() insead of regexp.FindSubMatch()
Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
Diffstat (limited to 'packet')
-rw-r--r-- | packet/bgp.go | 8 |
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 } |