google / cap-library

Common Alerting Protocol Library
Apache License 2.0
84 stars 26 forks source link

Little adjust on regex expression to validate date format #56

Closed calazans closed 9 years ago

calazans commented 9 years ago

The comment in the class com.google.publicalert.cap.CapDateUtil says that the right format for the date is "2002-05-24T16:49:00:00-07:00", but regex expression only matches the date when the separator between the seconds and the miliseconds is a dot "2002-05-24T16:49:00.00-07:00". Regex how is today : "[0-9]{4}-[01][0-9]-[0-3][0-9]T[0-2][0-9]:[0-5][0-9]:[0-5]0-9?([+|-])([01][0-9]:[0-5][0-9])"

Regex how should be : "[0-9]{4}-[01][0-9]-[0-3][0-9]T[0-2][0-9]:[0-5][0-9]:[0-5]0-9?([+|-])([01][0-9]:[0-5][0-9])"

calazans commented 9 years ago

wasn1 really a issue of the regex but it was a misunderstanding of the date format that should be passed