package main
import (
"regexp"
"fmt"
)
func main() {
var re = regexp.MustCompile(`(?m)^(\S+)\R(?=(?:\S+\R)*?\1$)`)
var str = `3170059109_usilitel-sluha-sluhovoj.jpg
3170059111_usilitel-sluha-sluhovoj.jpg
3170059113_usilitel-sluha-sluhovoj.jpg
3170059109_usilitel-sluha-sluhovoj.jpg
3170059111_usilitel-sluha-sluhovoj.jpg
3170059113_usilitel-sluha-sluhovoj.jpg
3683880649_otpugivatel-myshej-pest.jpg
3175071494_otpugivatel-myshej-pest.jpg
3683880650_otpugivatel-myshej-pest.jpg
3683880651_otpugivatel-myshej-pest.jpg
3683880649_otpugivatel-myshej-pest.jpg
3175071494_otpugivatel-myshej-pest.jpg
3683880650_otpugivatel-myshej-pest.jpg
3683880651_otpugivatel-myshej-pest.jpg
3170117180_sportivnyj-topik-ah.jpg
3170117180_sportivnyj-topik-ah.jpg
`
var substitution = ""
fmt.Println(re.ReplaceAllString(str, substitution))
}
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/