Can you translate something for me? My boyfriend is a programmer and has posted a message that I can’t understand at 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 does it mean? Is it a normal message with words or is it some kind of other code?
It’s an expression that attempts to match all valid date/times in
d/m/y H:M:Sformat, with or without leading zeros, and using 2- or 4-digit years, including Feb 29 on leap years. Not sure why he’d be sending you this, unless the context of your conversation makes it relevant somehow.It’d match:
plus a time in 24-hour format.
Looks like he didn’t account for leap seconds. Bad boy.
EDIT:
Looking over the regex again, it also looks like it won’t match
29/2/00 00:00:00. The leap year match for multiple-of-400 years doesn’t take 2-digit years into account. It really can’t do so in a way that won’t break in 80 years or so (or whenever00starts to mean 2100 and not 2000), unless he wants to define00as meaning 2000 for the expected life of the software and risk a very subtle Y2.1K bug if it lives that long.