package main
import (
"regexp"
"fmt"
)
func main() {
var re = regexp.MustCompile(`(?i)<a href="([^"]+)" target="([^"]+)" rel="([^"]+)" title="([^"]+)">([^<]+)<\/a>`)
var str = `test <a href="http://www.un-site.com/page.html" target="_blank" rel="nofollow" title="Mon site">Cliquez sur ce lien</a> test
test <a href="http://www.un-site2.com/page2.html" target="_new" rel="nofollow" title="Mon site2">Cliquez sur ce lien 2</a> test
test <a href="http://www.un-site3.com/page3.html" target="_parent" rel="nofollow" title="Mon site3">Cliquez sur ce lien 3</a> test
test <a href="http://www.un-site4.com/page4.html" target="frame" rel="nofollow" title="Mon site4">Cliquez sur ce lien 4</a> test`
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/