package main
import (
"regexp"
"fmt"
)
func main() {
var re = regexp.MustCompile(`(?m)((\b\p{Upper}\w+)|(\b\p{Upper}\w{1,5}\.)) ?( ((\b\p{Lower}{1,6})|(\b\p{Upper}\w+)|((\b\p{Upper}\w{1,5}\.)))){0,4} v\.? ((\b\p{Upper}\w+)|(\b\p{Upper}\w{1,5}\.)) ?( ((\b\p{Lower}{1,6})|(\b\p{Upper}\w+)|((\b\p{Upper}\w{1,5}\.)))){0,4}`)
var str = `This is not a case. But this is: Riley v. California. And riley v. california also isn't.
Riley v. California and Mapp v. Ohio "United Zinc & Chemical Co. v. Britt" should all count, but not MAPP V. OHIO!
Both R.A. Peacock v. Lubbock Compress Company and Battalla v. State of New York have complex names.
But also, Craggan v. IKEA USA and this Case: Edwards v. Honeywell, Inc..`
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/