gf/.example/other/test.go
2020-03-09 19:48:51 +08:00

17 lines
361 B
Go

package main
import (
"fmt"
"github.com/gogf/gf/text/gregex"
)
func main() {
data := "@var(.prefix)您收到的验证码为:@var(.code),请在@var(.expire)内完成验证"
result, err := gregex.ReplaceStringFuncMatch(`(@var\(\.\w+\))`, data, func(match []string) string {
fmt.Println(match)
return "#"
})
fmt.Println(err)
fmt.Println(result)
}