package main
import (
"regexp"
"fmt"
)
func main() {
var re = regexp.MustCompile(`(?m)href="(.+)(?<!\.css|\.js)"`)
var str = `href="http://testurl.com/abc/11111.html"
href="http://testurl.com/abc/22222.aspx"
href="http://testurl.com/abc/33333.php"
href="http://testurl.com/abc/44444.js"
href="http://testurl.com/abc/55555.css"
href="http://testurl.com/abc/66666.js"
href="http://testurl.com/abc/77777.html"`
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/