Please enable JavaScript to use regex101
/
^
r
e
g
e
x
[
\
-
_
]
?
1
0
1
$
/
i
Reg
ular
Ex
pressions
101
Upgrade to Pro
Enterprise
Regular Expression
/
^P(([0-9]+Y)?([0-9]+M)?([0-9]+W)?([0-9]+D)?(T([0-9]+H)?([0-9]+M)?([0-9]+(\.?[0-9]+)?S)?))?$
/
Unit Tests
PT0.S
→ regex does not match
P0.1D
→ regex does not match
PT0.0.0S
→ regex does not match
PT0.0S
→ regex does match
P5DT4H
→ regex does match
PT5HS
→ regex does not match
PT0H
→ regex does match