package main
import (
"regexp"
"fmt"
)
func main() {
var re = regexp.MustCompile(`(?m)(?!href)\b[\w]+=[\w" :]+`)
var str = `<table id="this is id">
<tr id="this tr id">
<a href="https://www.w3schools.com">Visit W3Schools.com!</a>
<div id="this is div id"><span id="div Class:a">this is span text</span></div>
</tr>
</table>`
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/