package main
import (
"regexp"
"fmt"
)
func main() {
var re = regexp.MustCompile(`(?ism)<a (.*?)href="(.+?)"(.*?)>(.*?)<\/a>`)
var str = `<a href="http://www.google.be">Google</a>
<a href="bestand.flv" test="blablabla">bestand</a>
<a target="_blank" href="Titels_opdrachten.pdf"><strong>titels van opdrachten in OLAT</strong></a>
<a id="5quot;>test</a>
<a href="hallo.png">hallo</a>`
var substitution = "<a href="$2">$4</a>"
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/