Variable: diary-icalendar-time-regexp
diary-icalendar-time-regexp is a variable defined in
diary-icalendar.el.gz.
Value
"\\(?1:\\(?11:[0-2][0-9]\\|[0-9]\\)\\(?:[:h]\\(?12:[0-5][0-9]\\)\\(?13:[ap]m\\)?\\|\\.\\(?12:[0-5][0-9]\\)\\(?:\\(?13:[ap]m\\)\\|h\\)\\|\\(?13:[ap]m\\)\\|h\\)\\)\\(?:-+\\(?2:\\(?21:[0-2][0-9]\\|[0-9]\\)\\(?:[:h]\\(?22:[0-5][0-9]\\)\\(?23:[ap]m\\)?\\|\\.\\(?22:[0-5][0-9]\\)\\(?:h\\|\\(?23:[ap]m\\)\\)\\|\\(?23:[ap]m\\)\\|h\\)\\)\\)?[[:space:]]+"
Documentation
Regular expression to match diary appointment times.
Accepted time formats look like e.g.:
9AM 9:00 09:00 9h 9h00 9.00am 9.00h
9PM 9:00pm 21:00 21h00 21.00pm 21.00h
9AM-1PM 09:00-13:00
Group 1 matches the start time:
Group 11 matches the hours digits
Group 12 matches the minutes digits
Group 13 matches an AM/PM specification
Group 2 matches the end time:
Group 21 matches the hours digits
Group 22 matches the minutes digits
Group 23 matches an AM/PM specification
Source Code
;; Defined in /usr/src/emacs/lisp/calendar/diary-icalendar.el.gz
;; TODO: give this value to diary-time-regexp?
(defconst di:time-regexp
(rx-let ((hours (or (seq (any "0-2") (any "0-9"))
(any "0-9")))
(minutes (seq (any "0-5") (any "0-9")))
(am/pm (seq (any "ap") "m"))) ;; am, pm
(rx
(group-n 1 ;; START
(group-n 11 hours) ;; start hour
(or
;; 10:00 or 10h00:
(seq (or ":" "h") (group-n 12 minutes) (opt (group-n 13 am/pm)))
;; 10.00h or 10.00am: (a bare "10.00" should not match)
(seq "." (group-n 12 minutes) (or (group-n 13 am/pm) "h"))
;; 10am
(group-n 13 am/pm)
;; 10h
"h"))
(zero-or-one
(one-or-more "-")
(group-n 2 ;; END
(group-n 21 hours) ;; end hour
(or
;; 10:00 or 10h00:
(seq (or ":" "h") (group-n 22 minutes) (opt (group-n 23 am/pm)))
;; 10.00h or 10.00am:
(seq "." (group-n 22 minutes) (or "h" (group-n 23 am/pm)))
;; 10am
(group-n 23 am/pm)
;; 10h
"h")))
(one-or-more space)))
"Regular expression to match diary appointment times.
Accepted time formats look like e.g.:
9AM 9:00 09:00 9h 9h00 9.00am 9.00h
9PM 9:00pm 21:00 21h00 21.00pm 21.00h
9AM-1PM 09:00-13:00
Group 1 matches the start time:
Group 11 matches the hours digits
Group 12 matches the minutes digits
Group 13 matches an AM/PM specification
Group 2 matches the end time:
Group 21 matches the hours digits
Group 22 matches the minutes digits
Group 23 matches an AM/PM specification")