“31/9/2010”, “31/09/2010” – September has 30 days only 10.
The only difference between the two forms is readability. The final two solutions allow all of the date formats, just like the first two examples.
We use alternation (see Recipe 2.8) inside a group to match various pairs of digits to form a range of two-digit numbers.
We use capturing groups here because you’ll probably want to capture the day and month numbers anyway.
29th in 2013, but this regex asserts that such is valid: regexr.com?
Replace both This chapter has several other recipes for matching dates and times.