This regular expression consists of three parts, separated by the OR operator.
Each part is HH type.
They are 0 [1-9], [1-9] and 1 [0-2].
/(0[1-9]:[0-5][0-9]((\ ){0,1})((AM)|(PM)|(am)|(pm)))|([1-9]:[0-5][0-9]((\ ){0,1})((AM)|(PM)|(am)|(pm)))|(1[0-2]:[0-5][0-9]((\ ){0,1})((AM)|(PM)|(am)|(pm)))/
Eason source
share