package main
import (
"regexp"
"fmt"
)
func main() {
var re = regexp.MustCompile(`(?m)^.*\b202[0-9]\.(?:1[0-2]|0[1-9])\.(?:3[01]|[12][0-9]|0[1-9]) Week (?:5[0-3]|[1-4][0-9]|0?[1-9]) Forecast\.xlsm$`)
var str = `/Users/X/Desktop/Test_Directory/2020.08.03 Week 53 Forecast.xlsm
/Users/X/Desktop/Test_Directory/2020.01.06 Week 2 Forecast.xlsm
/Users/X/Desktop/Test_Directory/2020.06.18 Week 25 Forecast.xlsm
/Users/X/Desktop/Test_Directory/2020.06.22 Week 26 Forecast.xlsm`
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/