package main
import (
"regexp"
"fmt"
)
func main() {
var re = regexp.MustCompile(`(?m)\/s1600-h\/[^\/\s'"]+`)
var str = `http://localhost/wpcomics/wp-content/images/_Tkt_A2r1p6I/RYijDxlcBEI/AAAAAAAAAEU/DDbPKl6WZ30/s1600-h/tedsobject.jpg
http://localhost/wpcomics/wp-content/images/_Tkt_A2r1p6I/RYijDxlcBEI/AAAAAAAAAEU/DDbPKl6WZ30/s400/tedsobject.jpg
http://localhost/wpcomics/wp-content/images/_Tkt_A2r1p6I/RYgspBlcBDI/AAAAAAAAAEI/rNF6YqYaaaA/s1600-h/artoutoftimebook.jpg
http://localhost/wpcomics/wp-content/images/_Tkt_A2r1p6I/RYgspBlcBDI/AAAAAAAAAEI/rNF6YqYaaaA/s400/artoutoftimebook.jpg
http://localhost/wpcomics/wp-content/images/_Tkt_A2r1p6I/RYaXmhlcBCI/AAAAAAAAAD8/YL8YxxkAAzk/s1600-h/funnyfables.jpg`
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/