The other issue is that regular expressions don’t deal directly with numbers. That’s because the characters for the digits 0 through 9 occupy consecutive positions in the ASCII and Unicode character tables.
You can’t tell a regular expression to “match a number between 1 and 31”, for instance. See Chapter 6 for more details on matching all kinds of numbers with regular expressions.
We use capturing groups here because you’ll probably want to capture the day and month numbers anyway.
The final two solutions are a little more complex, so we’re presenting these in both condensed and free-spacing form.