---- Annual subscription ----------------------
// ********************** Year fan quota 0001-9999 ********** ***************
// [1-9]/d {3} The number of thousands is greater than 0
/// D [1-9]/d {2} Hundreds of digits greater than 0
/// D {2} [1-9]/D 10 digits greater than 0
/// D {3} [1-9] digits greater than 0
// Finally: [1-9]/d {3} |/d [1-9]/d {2} |/d {2} [1-9]/d |/d {3} [1-9]
// ******************* The number of days in which the month is 1-31 for 1, 5, 7, 8, 10, and 12 is 1-31 days, mm-dd ******************
// (0 [1, 13578] | 1 [02]) // (0 [1-9] | [12]/d | 3 [01])
// ******************* The number of days for the month is-30, MM-dd *********************
// (0 [469] | 11) // (0 [1-9] | [12]/d | 30)
// ********************* Month is 2, consider the normal year, MM-dd *****************************
// 02 // (0 [1-9 | 1/d | 2 [0-8])
// The formula for the year-on-year table is as follows: ([1-9]/d {3} |/d [1-9]/d {2} |/d {2} [1 -9]/d |/d {3} [1-9]) // (0 [13578] | 1 [02]) // (0 [1-9] | [12]/d | 3 [01]) | (0 [469] | 11) // (0 [1-9] | [12]/d | 30 )) | (02 // (0 [1-9 | 1/d | 2 [0-8])
---- Considering the leap year ----------------------
// ********************* Leap year considerations, ****************
/// D {2} (0 [48] | [13579] [26] | [2468] [048])
// ******************* The year in which a person can be divisible by 400 in a leap year. The number that can be divisible by 400 is certainly 100, so the last two must be 00. We only need to ensure that the first two can be divisible by four.
// (0 [48] | [2468] [048] | [3579] [26]) 00
// ********************* In February, MM-dd ************************************* **
// 02 // (0 [1-9] | [12]/d)
// The statement of the year of renewal is as follows: (/d {2} (0 [48] | [13579] [26] | [2468] [048]) | (0 [48] | [2468] [048] | [3579] [26]) 00) // (0 [13578] | 1 [02]) // (0 [1-9] | [12]/d | 3 [01]) | (0 [469] | 11) // (0 [1-9] | [12]/d | 30) | (02 // (0 [1-9] | [12]/d )))
// The final result is:
^ ([1-9]/d {3} |/d [1-9]/d {2} |/d {2} [1-9]/d | /d {3} [1-9]) // (0 [13578] | 1 [02]) // (0 [1-9] | [12]/d | 3 [01]) | (0 [469] | 11) // (0 [1-9] | [12]/d | 30 )) | (02 // (0 [1-9 | 1/d | 2 [0-8]) | (/d {2} (0 [48] | [13579] [26] | [2468] [048]) | (0 [48] | [2468] [048] | [3579] [26]) 00) // (0 [13578] | 1 [02]) // (0 [1-9] | [12]/d | 3 [01]) | (0 [469] | 11) // (0 [1-9] | [12]/d | 30 )) | (02 // (0 [1-9] | [12]/d) $
The above is a regular expression in the format of 2010/09/09.
If you want to change the format to 2010-10-10, you only need to replace // /-.