Please enable JavaScript to use regex101
/
^
r
e
g
e
x
[
\
-
_
]
?
1
0
1
$
/
i
Reg
ular
Ex
pressions
101
Upgrade to Pro
Enterprise
Community Library
How to contribute
x
Extract times from a string
Open Workspace
PCRE (Legacy)
Match
Created 2015-07-14 03:19
1
Regular Expression
/
(
[
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.