mirror of
https://gitee.com/johng/gf.git
synced 2024-12-04 13:18:01 +08:00
14 lines
230 B
Go
14 lines
230 B
Go
|
package gregx
|
||
|
|
||
|
import (
|
||
|
"regexp"
|
||
|
)
|
||
|
|
||
|
// 正则表达式是否匹配
|
||
|
func IsMatch(val, pattern string) bool {
|
||
|
match, err := regexp.Match(pattern, []byte(val))
|
||
|
if err != nil {
|
||
|
return false
|
||
|
}
|
||
|
return match
|
||
|
}
|