Instant regex question


#1

Hi, just detected an 14:00 at the end of the instant and datetime regexes:

Regex: ([0-9]([0-9]([0-9][1-9]|[1-9]0)|[1-9]00)|[1-9]000)-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])T([01][0-9]|2[0-3]):[0-5][0-9]:([0-5][0-9]|60)(\.[0-9]+)?(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|**14:00**))

([0-9]([0-9]([0-9][1-9]|[1-9]0)|[1-9]00)|[1-9]000)(-(0[1-9]|1[0-2])(-(0[1-9]|[1-2][0-9]|3[0-1])(T([01][0-9]|2[0-3]):[0-5][0-9]:([0-5][0-9]|60)(\.[0-9]+)?(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|**14:00**)))?)?)?

taken from www dot hl7 dot org/fhir/datatypes.html#dateTime

What is the 14:00 doing there?


#2

the regex allows for all valid timezones, which is -14:00 to 14:00 in 15 min intervals. Yay for Kiribati (https://en.wikipedia.org/wiki/UTC%2B14:00). I believe that later than -11:00 is not in use at this time.


#3

I see, the (0[0-9]|1[0-3]) allows 00 to 13 only.

About the 15 minute interval: this allows 1 minute intervals [0-5][0-9]


#4

indeed yes. I did not say it only allows valid timezones. There was some contention back when we first wrote that regex as to whether we needed to allow for non quarter of hour timezones - supposedly not legal, but that’s not the same as not used. (also depends on how historical you think the data type has to be). Right now, we’d only consider changing it if someone produced a valid timezone that is in use that isn’t legal by it