GoFrame gregex-基本使用

一个简单示例:

package main

import (
	"fmt"
	"github.com/gogf/gf/v2/text/gregex"
)

func main() {
	match, _ := gregex.MatchString(`(w+).+--s*(.+)`, `GF is best! -- John`)
	fmt.Printf(`%s says "%s" is the one he loves!`, match[2], match[1])
}

执行后,输出结果为:

John says "GF" is the one he loves!

作者:andy,如若转载,请注明出处:https://www.web176.com/goframe/20900.html

(0)
打赏 支付宝 支付宝 微信 微信
andy的头像andy
上一篇 2023年5月18日
下一篇 2023年5月18日

相关推荐

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注