需要定期EX pression为DD-MMM-yyyy格式验证日期 [英] Need regular expression for validating date in dd-MMM-yyyy format

查看:214
本文介绍了需要定期EX pression为DD-MMM-yyyy格式验证日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不以书面形式定期EX pressions所以需要你的帮助的专家。我想在DD-MMM-YYYY格式,即07军2012年来验证日期。我正在使用asp.net RegularEx pressionValidator。

任何人都可以帮我提供前pression?

感谢您分享您的时间。


解决方案

使用一个datepicker可能是最好的办法。然而,因为这不是你问什么,这里有一个选项(虽然它是区分大小写):

<$p$p><$c$c>^(([0-9])|([0-2][0-9])|([3][0-1]))\\-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\\-\\d{4}$

此外,这里就是你可以很容易地测试正防爆pressions的地方:<一href=\"http://www.regular-ex$p$pssions.info/javascriptexample.html\">http://www.regular-ex$p$pssions.info/javascriptexample.html

I am not expert in writing regular expressions so need your help. I want to validate date in "dd-MMM-yyyy" format i.e. 07-Jun-2012. I am using RegularExpressionValidator in asp.net.

Can anybody help me out providing the expression?

Thanks for sharing your time.

解决方案

Using a DatePicker is probably the best approach. However, since that's not what you asked, here's an option (although it's case sensitive):

^(([0-9])|([0-2][0-9])|([3][0-1]))\-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\-\d{4}$

In addition, here's a place you can easily test Regular Expressions: http://www.regular-expressions.info/javascriptexample.html

这篇关于需要定期EX pression为DD-MMM-yyyy格式验证日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆