Ai
1 Star 0 Fork 0

smooe/tools

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
verify.go 348 Bytes
一键复制 编辑 原始数据 按行查看 历史
shao 提交于 2023-06-07 21:36 +08:00 . 添加文件
package tools
import "regexp"
// 正则匹配,允许包含中文
func MatchCN(s string) bool {
regx := "^[\u4E00-\u9FA5A-Za-z0-9_-]+$"
re := regexp.MustCompile(regx)
return re.MatchString(s)
}
func Conform(s string) bool {
// 匹配中文 英文 数字 及 _.-
regx := regexp.MustCompile("^[A-Za-z0-9_.-@]+$")
return regx.MatchString(s)
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/smooe/tools.git
git@gitee.com:smooe/tools.git
smooe
tools
tools
v0.0.4

搜索帮助