package main
import (
"regexp"
"fmt"
)
func main() {
var re = regexp.MustCompile(`<p>DETAILS[\s\S]*|(<p>.*?<\/p>)|.*`)
var str = `<info>
<owner>
<p>Owners:</p>
<p>1. New Owner_1</p>
<p>2. New Owner_2</p>
</owner>
<addons>
<p>Name of dog: Alex</p>
<p>1. Text blah blah blah</p>
<p>2. Text blah blah blah</p>
<p>3. Text blah blah blah</p>
<p>4. Text blah blah blah</p>
<p>OR MORE Text blah blah blah</p>
</addons>
<p>DETAILS</p>
<p>1. Vicky Mears 1st dog's owner.</p>
<p>2. Paul Nash 2nd dog's owner.</p>
<p>3. Dog found last Apr. 2016</p>
</info>`
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/