Regex for Date (DD/MM/YYYY)
Validates dates in DD/MM/YYYY format with basic day/month range checking.
Pattern
/^(0[1-9]|[12]\d|3[01])\/(0[1-9]|1[0-2])\/\d{4}$/ Live Tester
Enter a string to test
Examples
✓ 15/01/2024
✓ 31/12/2023
✓ 01/06/2000
✗ 32/01/2024
✗ 15/13/2024
✗ 1/6/2000
Pattern Breakdown
^(0[1-9]|[12]\d|3[01]) — day 01-31
\/ — literal forward slash
(0[1-9]|1[0-2]) — month 01-12
\/\d{4}$ — slash + four-digit year
Code Snippets
Javascript
const regex = /^(0[1-9]|[12]\d|3[01])\/(0[1-9]|1[0-2])\/\d{4}$/;
regex.test("15/01/2024"); // true Python
import re
pattern = r"^(0[1-9]|[12]\d|3[01])/(0[1-9]|1[0-2])/\d{4}$"
bool(re.match(pattern, "15/01/2024")) # True Php
$pattern = '/^(0[1-9]|[12]\d|3[01])\/(0[1-9]|1[0-2])\/\d{4}$/';
preg_match($pattern, "15/01/2024"); // 1 Related Patterns
Email Address /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/ URL /^https?:\/\/(www\.)?[a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([a-zA-Z0-9()@:%_+.~#?&/=-]*)$/ Phone Number (International) /^\+?[1-9]\d{1,14}$/ Phone Number (US) /^\(?[2-9]\d{2}\)?[-.\s]?\d{3}[-.\s]?\d{4}$/ Phone Number (EU) /^\+?[1-9][0-9]{0,3}[\s.-]?\(?[0-9]{1,5}\)?[\s.-]?[0-9]{1,5}[\s.-]?[0-9]{1,5}$/ IPv4 Address /^((25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(25[0-5]|2[0-4]\d|[01]?\d\d?)$/
Frequently Asked Questions
What is the regex for Date (DD/MM/YYYY)?▾
The regex pattern for Date (DD/MM/YYYY) is /^(0[1-9]|[12]\d|3[01])\/(0[1-9]|1[0-2])\/\d{4}$/. Validates dates in DD/MM/YYYY format with basic day/month range checking.
How do I use the Date (DD/MM/YYYY) regex in JavaScript?▾
In JavaScript you create the pattern with a regex literal or the RegExp constructor and call .test() to check a string against it. A ready-to-copy example is shown in the Code Snippets section above, alongside Python and PHP versions.
What does the Date (DD/MM/YYYY) pattern match?▾
It matches strings like 15/01/2024; it rejects strings like 32/01/2024. See the Examples section above for the full list of matching and non-matching cases.