1. 程式人生 > >使用正則表示式驗證一個月的31天

使用正則表示式驗證一個月的31天

實現效果:

關鍵運用:

 

實現程式碼:

 

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