From 1b89bfd4b779d5f719dccfcb699789d40ddb3ffd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BB=A3=E5=90=9B?= Date: Wed, 7 Dec 2016 18:25:37 +0800 Subject: [PATCH] =?UTF-8?q?.=E5=8F=AA=E8=83=BD=E5=8C=B9=E9=85=8D=E4=BB=BB?= =?UTF-8?q?=E6=84=8F=E5=AD=97=E7=AC=A6=E4=B8=80=E6=AC=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 要匹配由数字和字母组成的字符,需要使用"^[a-zA-Z0-9]+$","^[a-zA-Z0-9]+."只能匹配由数字字母开头和一个任意字符组成的两个长度的字符串。 --- zh/09.2.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zh/09.2.md b/zh/09.2.md index e3b1d55a..58f97fdb 100644 --- a/zh/09.2.md +++ b/zh/09.2.md @@ -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 }