package main
import (
"regexp"
"fmt"
)
func main() {
var re = regexp.MustCompile(`(?m)(?i)[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}`)
var str = `e876c866-1dd6-4c32-bf27-7ab673b57f75
d9da6fe0-cf69-40ae-9263-a115aac94441
bc783e58-3cac-4efb-92ee-560b696674c8
7b054304-c5dd-4595-a390-fd4f4b700e33
20255eea-5679-4fa7-8e65-4bab69425727
8039e4c6-4032-4065-8723-b0351d4a33f0
e9b3f927-b87a-459a-8a5b-caba3ccc8968
edbdb831-6e92-4241-8ba9-0bba71a1d7b0
087b5b52-97e6-4341-8976-59674ecbef2d
d78be4c5-a0ba-4ef4-ab77-97585aa61436`
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/