Regular Expressions 101

Community Patterns

Community Library Entry

1

Regular Expression
PCRE (PHP <7.3)

/
([0-9]{1,2}:?(?:[0-9]{2})?)-([0-9]{1,2}:?(?:[0-9]{2})?)\s(AM|PM)
/
ig

Description

I use this to extract and later calculate the difference between two times.

Submitted by Ernie C. - 9 years ago