package main
import (
"regexp"
"fmt"
)
func main() {
var re = regexp.MustCompile(`(?m)(?<=^block )\w+\n`)
var str = `extends standard
block head
<title>title</title>
<meta name="description" content="A wonderful thing.">
block body
<h1>Title</h1>
<p>A wonderful paragraph...</p>
block scripts
<script src="/javascritps/html5shiv.js"></script>`
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/