package main
import (
"regexp"
"fmt"
)
func main() {
var re = regexp.MustCompile(`(?m)\bid\s+:\s*\b([0-9a-f]{8}\b-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-\b[0-9a-f]{12})\b`)
var str = `id : 42cdb643-0a11-416b-b66b-7bb28a9a20ea
isReadOnly : False
somestring : False
somestring : {}
name :
id : d006d69e-8d04-48d7-8806-cdc39c18e679
somestring : False
somestring : False
somestring : 822F0340-818A-4F23-AA78-633B6436913F
upstreamDataflowsOfDatasets : {}`
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/