package main
import (
"regexp"
"fmt"
)
func main() {
var re = regexp.MustCompile(`{{photo::start}}(\X+){{photo::stop}}`)
var str = `
</div>
<!-- Gallery -->
<div id="ap-product-gallery" class="ap-cf">
{{photo::start}}
<div class="ap-pg-photo-wrapper">
<img src=" class="a" width="586" />
</div>{{photo::stop}}
<div class="ap-pg-photo-wrapper">
<img src="link.jpg" class="ap-pg-photo" width="586" />
</div>
<div class="ap-pg-photo-wrapper">
<img src="link.jpg" class="ap-pg-photo" width="586" />
</div>
<div class="ap-pg-photo-wrapper">
<img src="link.jpg" class="ap-pg-photo" width="586" />
</div>
</div>
<!-- Banner -->`
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/