package main
import (
"regexp"
"fmt"
)
func main() {
var re = regexp.MustCompile(`(?ms)\h*(?<!`)<\?(\w+)\h*([^\v]*)\v*(.*?)\s*\?>`)
var str = `<x-section markdown="1" name="heros">
<x-container markdown="1" title="Heros" class="decorate-left prose">
{.lead}Heros are the header shown at the top of each page.
<?md class="asdf"
asdf
asdf
?>
<div><?md
asdf
?>
<?md x="y"
asdf
?>
They get \`<?md\` inserted automatically for you. Nothing extra to do here.
The only requirement is to set a \`hero\` key in the Front Matter for your page.
`
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/