Skip to content

Sort-o-matic

Objective

Minty Candycane wants help fixing the sortomatic. Create regex patterns to match the strings that the Sort-o-matic requires.

Tip

Writing regex patterns is easier when you use a regex tester/debugger like RegEx101.

Solution

1) Matches at least one digit

\d+

2) Matches 3 alpha a-z characters ignoring case

[A-Za-z]{3}

3) Matches 2 chars of lowercase a-z or numbers

[a-z0-9]{2}

4) Matches any 2 chars not uppercase A-L or 1-5

[^A-L1-5]{2}

5) Matches three or more digits only

^\d{3,}$

6) Matches multiple hour:minute:second time formats only

^(\d|[0-1]\d|2[0-3]):([0-5][0-9]):([0-5][0-9])$

7) Matches MAC address format only while ignoring case

^([0-9A-Fa-f]{2}[:]){5}([0-9A-Fa-f]{2})$

8) Matches multiple day, month, and year date formats only

^(0[1-9]|[1-2]\d|3[0-1])[-\/.](0[1-9]|1[0-2])[-\/.](19|20)\d\d$