使用正则表达式验证一个月的31天

Posted on 2018-11-18 16:34  努力成长静待花开  阅读(1233)  评论(0编辑  收藏  举报

实现效果:

关键运用:

 

实现代码:

 

        public bool IsValidateDay(string str_day) {
            return System.Text.RegularExpressions.
                Regex.IsMatch(str_day,@"^((0?[0-9])|((1|2)|[0-9])|30|31)$");
        }