Ran*_*man 5 regex go

SubexpNames

这是一个例子:

package main

import (
    "fmt"
    "regexp"
)

func main() {
    re := regexp.MustCompile("(?P<first>[a-zA-Z]+) ")
    fmt.Printf("%q\n", re.SubexpNames())
    fmt.Printf("%q\n", re.FindAllStringSubmatch("Alan Turing ", -1))
}

输出为:

["" "first"]
[["Alan " "Alan"] ["Turing " "Turing"]]

是否可以获取每个子匹配项的捕获组名称?