package main
import (
"regexp"
"fmt"
)
func main() {
var re = regexp.MustCompile(`(?m).*mod_(\S+?)(-part-\d+)?\.(csv|json)`)
var str = `cid:d09004b7478a4f338bf647519edf71a3/tag:1595602064/aid:095438ff38da41e4444059fdbd9af9fd/pid:64756d6d792c484f555345424152415448454f4e2c31302e3136302e332e3232342c323032302d30372d32375432325f35385f31315a2e786d6ce3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855/mod_dirlist-part-000001.json.gz`
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/