regex - Regular expression - How to translate it? -


can translate me? boyfriend programmer , has posted message can't understand @ all.

^((((31\/(0?[13578]|1[02]))|((29|30)\/(0?[1,3-9]|1[0-2])))\/(1[6-9]|[2-9]\d)?\d{2})|(29\/0?2\/(((1[6-9]|[2-9]\d)?(0[48]|[2468][048]|[13579][26])|((16|[2468][048]|[3579][26])00))))|(0?[1-9]|1\d|2[0-8])\/((0?[1-9])|(1[0-2]))\/((1[6-9]|[2-9]\d)?\d{2})) (20|21|22|23|[0-1]?\d):[0-5]?\d:[0-5]?\d$

what mean? normal message words or kind of other code?

it's expression attempts match valid date/times in d/m/y h:m:s format, or without leading zeros, , using 2- or 4-digit years, including feb 29 on leap years. not sure why he'd sending this, unless context of conversation makes relevant somehow.

it'd match:

  • the 31st day of january, march, may, july, august, october, or december, or 29th or 30th days of month february, in year 1600 9999;
  • the 29th day of february in multiple-of-4-but-not-100 year 1604 9996, or multiple-of-400 years 1600 9600;
  • or day 1-28 in month in year 1600 9999;

plus time in 24-hour format.

looks didn't account leap seconds. bad boy.

edit:

looking on regex again, looks won't match 29/2/00 00:00:00. leap year match multiple-of-400 years doesn't take 2-digit years account. can't in way won't break in 80 years or (or whenever 00 starts mean 2100 , not 2000), unless wants define 00 meaning 2000 expected life of software , risk subtle y2.1k bug if lives long.


Comments