Regular expression conditional matching

how do regular expressions match multiple conditions?

for example: if you want to match the month and day of the whole year in 2017, it is 20170101 to 20171231

.

also want to match the date before August 2018 is 20180101 to 20180731

ask for a solution.

Apr.09,2021

/ ^ (2017 (0\ d | 10 | 11 | 12) | 2018 (0 [1-7])) ([0-2] [0-9] | 30 | 31) $/


is it difficult to match? There are months 28 and 30 days in leap years like this.
Baidu search, you change.

3.
^((([0-9]{2})(0[48]|[2468][048]|[13579][26]))   -sharp4100
|((0[48]|[2468][048]|[13579][26])00)   -sharp400
-02-29)  -sharp229 
|([0-9]{3}[1-9]|[0-9]{2}[1-9][0-9]{1}|[0-9]{1}[1-9][0-9]{2}|[1-9][0-9]{3}) -sharp0001-9999
-(((0[13578]|1[02])-(0[1-9]|[12][0-9]|3[01]))   -sharp13578101231
|((0[469]|11)-(0[1-9]|[12][0-9]|30))   -sharp4691130
|(02-(0[1-9]|[1][0-9]|2[0-8])))   -sharp22802-0102-28

(2017[0-1][0-9].{2}|20180[1-7].{2})

statement focuses on (expression 1 | expression 2)

means matching expression 1 or matching expression 2

Menu