package main
import (
"regexp"
"fmt"
)
func main() {
var re = regexp.MustCompile(`(?m)_2020\d{4}_|\.`)
var str = `_20201007144100_20200416_reg.zip
_20201007103200_20201007.zip
_20201007095000_20201007.zip
_20201007092933_20201007.zip
_20201007061717_20201007_txn.zip
_20201007041719_20201007.zip`
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/