gf/g/util/gregx/regx.go

14 lines
230 B
Go
Raw Normal View History

2017-11-23 10:21:28 +08:00
package gregx
import (
"regexp"
)
// 正则表达式是否匹配
func IsMatch(val, pattern string) bool {
match, err := regexp.Match(pattern, []byte(val))
if err != nil {
return false
}
return match
}