.只能匹配任意字符一次

要匹配由数字和字母组成的字符,需要使用"^[a-zA-Z0-9]+$","^[a-zA-Z0-9]+."只能匹配由数字字母开头和一个任意字符组成的两个长度的字符串。
This commit is contained in:
代君
2016-12-07 18:25:37 +08:00
committed by GitHub
parent 8d7accd78c
commit 1b89bfd4b7

View File

@@ -59,7 +59,7 @@
r.ParseForm()
username := r.Form.Get("username")
CleanMap := make(map[string]interface{}, 0)
if ok, _ := regexp.MatchString("^[a-zA-Z0-9].$", username); ok {
if ok, _ := regexp.MatchString("^[a-zA-Z0-9]+$", username); ok {
CleanMap["username"] = username
}