package main
import (
"regexp"
"fmt"
)
func main() {
var re = regexp.MustCompile(`(?m)# Parse Table grab from https://sashamaps.net/docs/resources/20-colors/
(?:
(?P<NAME>[A-Za-z]+)
\# (?P<HEX>[0-9a-fA-F]{6})
(?P<ID>\d+)
)`)
var str = `Red#e6194B1Green#3cb44b2Yellow#ffe1193Blue#4363d84Orange#f582315Purple#911eb46Cyan#42d4f47Magenta#f032e68Lime#bfef459Pink#fabed410Teal#46999011Lavender#dcbeff12Brown#9A632413Beige#fffac814Maroon#80000015Mint#aaffc316Olive#80800017Apricot#ffd8b118Navy#00007519Grey#a9a9a920White#ffffff21
Black#00000022`
for i, match := range re.FindAllString(str, -1) {
fmt.Println(match, "found at index", i)
}
}
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for Golang, please visit: https://golang.org/pkg/regexp/