package main
import (
"regexp"
"fmt"
)
func main() {
var re = regexp.MustCompile(`<img\b[^<>]*?src=(['"].*?\/)([^.\/<>]*\.[^.\/<>]*)['"][^><]*?\/>`)
var str = `<p>Lorem ipsum dolor sit amet.</p><img src="https://lh5.googleusercontent.com/-1G1Z51IFZe4/TYbMLgP8ObI/AAAAAAAAAas/WteAs_b7xzc/s320/herminafinal.jpg" /><p>Lorem ipsum dolor sit amet.</p>`
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/