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
/
^(?<weekdays> ( \b (?<weeks>mon|tue|wed|thu|fri|sat|sun) (?:\.\.(?&weeks))? ,? )+ )$
/
ix
Unit Tests
accepts single days
accepts several days
accepts an optional trailing comma
accepts ranges
accepts ranges combined with single days
does NOT accept ranges with more than two parts
does NOT accept double trailing commas
does NOT accept double delimiting commas
does NOT accept double range delimiters
does NOT accept a double day