package main
import (
"regexp"
"fmt"
)
func main() {
var re = regexp.MustCompile(`\blog(\w+)\(([^()]+)\)`)
var str = `logBug(var1, var2)
logInfo("aa", var2)
logWarning("aa", "bb")
logFun(msg1 = "aa", msg2 = "bb")
logFun(msg1 = var1, msg2 = "bb")`
var substitution = "logGeneral(\2, type = "\L\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/