Date, year, month, and day Regular Expressions

Source: Internet
Author: User

This can only be used in Java and cannot be used in JavaScript. JavaScript does not support reverse pre-search. Yyyy-MM-dd, yyy-MM-dd, yy-MM-dd, and y-MM-dd are supported, that is, the year is 1 ~ Four digits in the range of (1 ~ 9999, not 0 a.m.), the month and the day should be two digits (if the month and the day are to be a digit, You need to modify it a little ), the separator is "-" (comments are added to all separators and can be changed to other characters ).

(? : [0-9] {1, 4 }(? <! ^ 0? 0? 0? 0 ))-(? : 0 [1-9] | 1 [0-2])-(? : 0 [1-9] | 1 [0-9] | 2 [0-8] | (? :(? <= (? : 0 [1, 13578] | 1 [02])-) (? : 29 | 3 [01]) | (? :(? <= (? : 0 [469] | 11 )-)(? : 29 | 30) | (? :(? <= (? :(? : [0-9] {0, 2 }(?! 0? 0 )(? : [02468]? (? <! [13579]) [048] | [13579] [26]) | (? :(? : [02468]? [048] | [13579] [26]) 00)-02 -)(? : 29 )))

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.