package main
import (
"regexp"
"fmt"
)
func main() {
var re = regexp.MustCompile(`(?mi)(?:\b\w*(\w)(?=[^\w\n]+\1)[^\w\n]+)+\w+`)
var str = `word"§$Dark!"§ king glow
word dark king glow we end
word dark king glow we end hello bye low wing
AB
A A
A B
AB B
AB BC D
AB BC CE
AB C
`
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/