package main
import (
"regexp"
"fmt"
)
func main() {
var re = regexp.MustCompile(`(?m)\s?(\p{Lu}[\p{Lu}+\p{Ll}]*\p{Lu}*)|(\p{Lu}*[\p{Lu}+\p{Ll}]*\p{Lu}+)\s?`)
var str = `hello world at MSDN Magazine published in LaTeX Format tomaX Tomax TMa TMAx TmAX toTHE `
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/