regexp是golang标准库自带的正则校验包,使用:
re, _ := regexp.Compile(`(\d+)年(\d+)月`) //判断是否匹配category类别搜索
ismatch := re.MatchString(tag)
校验某字符串是否符合"xx年xx月"格式,over。。。
regexp是golang标准库自带的正则校验包,使用:
re, _ := regexp.Compile(`(\d+)年(\d+)月`) //判断是否匹配category类别搜索
ismatch := re.MatchString(tag)
校验某字符串是否符合"xx年xx月"格式,over。。。
转载于:https://my.oschina.net/caiya928/blog/784052