How the pattern works
| Part | Meaning |
|---|---|
(?:0[1-9]|[12]\d|3[01]) | Day 01–31 first (UK, European, Indian and Australian order) |
\/ | A slash |
(?:0[1-9]|1[0-2]) | Month 01–12 |
\d{4}$ | Four-digit year |
Code examples
JavaScript
const re = /^(?:0[1-9]|[12]\d|3[01])\/(?:0[1-9]|1[0-2])\/\d{4}$/;
re.test(value); // true or falsePython
import re
bool(re.fullmatch(r'(?:0[1-9]|[12]\d|3[01])/(?:0[1-9]|1[0-2])/\d{4}', value))PHP
preg_match('/^(?:0[1-9]|[12]\d|3[01])\/(?:0[1-9]|1[0-2])\/\d{4}$/', $value) === 1;
Notes and limitations
Swap \/ for [\/.-] to accept 30.10.2026 and 30-10-2026 as well. Days per month aren’t checked.
Regex TesterType a pattern and watch matches highlight live in your test text.
Open the tool Frequently asked questions
What is the regex for date (DD/MM/YYYY)?
/^(?:0[1-9]|[12]\d|3[01])\/(?:0[1-9]|1[0-2])\/\d{4}$/ — it matches the whole string. See the table above for what each part does.
Which examples match?
Of the examples tested, these match: 30/10/2026, 01/12/2000, 31/01/1999. The others don’t.
How do I test this regex?
Click “Open in Regex Tester” — the pattern, flags and sample text load automatically, and matches highlight as you edit.