package main
import (
"regexp"
"fmt"
)
func main() {
var re = regexp.MustCompile(`(?m)(?:INSERT_|UPDATE_)?([NY|80]{2}[0-9]{6})_([^0-9]*)_([0-9]{4})_06_30\.(?:txt|csv)`)
var str = `UPDATE_80070175_LOCATION_MARKING_PERIOD_2020_06_30.txt
INSERT_80070175_STUDENT_CLASS_GRADE_DETAIL_2020_06_30.txt
INSERT_80070175_STUDENT_CLASS_ENTRY_EXIT_2020_06_30.txt
INSERT_80070175_STUD_ATTEND_DAY_2020_06_30.txt
INSERT_80070175_PROGRAMS_FACT_2020_06_30.txt
INSERT_80070175_DAY_CALENDAR_2020_06_30.txt
INSERT_80070175_CRSE_INSTRUCT_ASSIGNMENT_2020_06_30.txt
INSERT_80070175_COURSE_2020_06_30.txt
INSERT_80070175_ATTENDANCE_CODES_2020_06_30.txt
80070175_STUDENT_LITE_UPDATE_2020_06_30.txt
80070175_SCHOOL_ENTRY_EXIT_INSERT_2020_06_30.txt
`
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/