package main
import (
"regexp"
"fmt"
)
func main() {
var re = regexp.MustCompile(`(?m)^spotify\/streams\/\d{8}\/[A-Z]{2}_streams_\d{8}\.csv`)
var str = `spotify/streams/20200819/NL_streams_20200819.csv
spotify/streams/20200819/nl_streams_20200819.csv
test/spotify/tracks
spotify/tracks/hello.world`
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/