package main
import (
"regexp"
"fmt"
)
func main() {
var re = regexp.MustCompile(`(?i)[^`\w@\\](t[xyq]|th(nx|nq|x)|than[xk](s)?(you|[syxzq]){0,1})\b`)
var str = `#- Should match
tx, ty, tq,
thnq, thx, thnx,
thanx, thanxyou, thanxs, thanxy, thanxx, thanxz, thanxq, thanxss, thanxsy, thanxsx, thanxsz, thanxsq
thank, thankyou, thanks, thanky, thankx, thankz, thankq, thankss, thanksy, thanksx, thanksz, thanksq
...
#- Shouldn't work
thanksk
thans
than
thanker
thanking
thxq
thnxs
txs
taxs
\`thanks\`
\`\`\` a real world testing of thanks regex \`\`\`
_thanks_
tank of pleasure
tax is high
taks away!
tanks are everywhere
@thanks buddy
# Shouldn't match
@thanks
@tanks
@tx
@ty
thankqx`
var substitution = "$1"
fmt.Println(re.ReplaceAllString(str, substitution))
}
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/