Dec 19, 2010

Crazy Regular Expression Test 1


Using Regex to check whether a string is a valid date format or not


/^(?:(?:[0-9]+-(?:(?:(?:0*(?:[13578]|(?:1[02])))-(?:0*(?:[1-9]|(?:[12][0-9])|(?:3[01]))))|(?:0*(?:[469]|(?:11))-(?:0*(?:[1-9]|(?:[12][0-9])|(?:30))))|(?:0*2-(?:0*(?:[1-9]|(?:1[0-9])|(?:2[0-8]))))))|(?:(?:(?:0*[048])|(?:[0-9]*(?:(?:0[48])|(?:[13579][26])|(?:[2468][048])))|(?:[0-9]*(?:(?:[48])|(?:[13579][26])|(?:[02468][048]))(?:00)))-(?:(?:(?:0*(?:[13578]|(?:1[02])))-(?:0*(?:[1-9]|(?:[12][0-9])|(?:3[01]))))|(?:0*(?:[469]|(?:11))-(?:0*(?:[1-9]|(?:[12][0-9])|(?:30))))|(?:0*2-(?:0*(?:[1-9]|(?:[12][0-9])))))))$/

512 characters


0 comments:

Post a Comment

Twitter Delicious Facebook Digg Google Favorites More

 
Design by Free WordPress Themes | Bloggerized by Lasantha - Premium Blogger Themes | Best Hostgator Coupon Code