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
r"""
(\s?( # match deliminators here to make word border below unambiguous (?P<years>[\+-]?\d+)\s?(years?|y) | (?P<months>[\+-]?\d+)\s?(months?|mo) | (?P<weeks>[\+-]?\d+)\s?(weeks?|w) | (?P<days>[\+-]?\d+)\s?(days?|d) | (?P<hours>[\+-]?\d+)\s?(hours?|hrs|hr?) | (?P<minutes>[\+-]?\d+)\s?(minutes?|mins?|m) | (?P<seconds>[\+-]?\d+)\s?(seconds?|secs?|s) ))+\b
"""
ix
Input 1
2 weeks -4 days +5 seconds 19 warnings and counting
Substitution
2 weeks -4 days +5 seconds 19 warnings and counting