Regular Expressions 101

Community Patterns

RegEx for TimeZone OffSet with optional - sign and range from -14:00 to 14:00 with minutes 00,15,30,45

0

Regular Expression
PCRE (PHP <7.3)

/
^-?(((([0][0-9])|([1][0-3])):(([03][0])|([14][5])))|14:00)
/
gm

Description

TimeZone Offset parsing regular expression with below rules: Starts with optional - sign Range is between -14:00 to 14:00 including both the values Hours can have any value in range 00 to 14 and should have double digits Minutes can have discrete values of 00, 15, 30, 45

Submitted by anonymous - 4 years ago