package main
import (
"regexp"
"fmt"
)
func main() {
var re = regexp.MustCompile(`(?m)^((?!(https:\/\/abc\.com|https:\/\/def\.com)).)*$`)
var str = `http://abc.com/somepage.html
http://abc.com/someotherpage.asp
https://abc.com/somepage.html
https://abc.com/someotherpage.asp
http://blef.com/boo.html
https://blef.com/bar.asp
http://blef.com
http://def.com/somepage.html
http://def.com/someotherpage.asp
https://def.com/somepage.html
https://def.com/someotherpage.asp`
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/