package main
import (
"regexp"
"fmt"
)
func main() {
var re = regexp.MustCompile(`(?s)<li>[^<>]*<strong>Downloads:<\/strong>\s*\K.*?(?=\s*<\/li>)`)
var str = `<ul>
<li>
<strong>Online:</strong>
2/14/2010 3:40 AM
</li>
<li>
<strong>Hearing Impaired:</strong>
No
</li>
<li>
<strong>Downloads:</strong>
3,840
</li>
</ul>`
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/