package main
import (
"regexp"
"fmt"
)
func main() {
var re = regexp.MustCompile(`(?m)\bCOLOR="[^\na-zA-Z"]*\b([a-zA-Z]+)\b[^\n"]*"`)
var str = `COLOR="WHITE 화이트", DETAIL="NONE"
SLEEVE="SHORT 쇼트", COLOR="BLUE"
SLEEVE="LONG", COLOR="GRAY", TOP="DOUBLE"
COLOR="YELLOW 노랑"
COLOR="화이트 WHITE", DETAIL="NONE"`
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/