US Date Format (MM/DD/YYYY)
Match US-style dates in MM/DD/YYYY format with range validation.
Try it in RegexPro →Available in
JavaScript / ECMAScript code
const re = new RegExp("(?:0[1-9]|1[0-2])\\/(?:0[1-9]|[12]\\d|3[01])\\/\\d{4}", "g");
const input = "01/15/2024";
const matches = [...input.matchAll(re)];
console.log(matches.map(m => m[0]));Uses `String.prototype.matchAll` for global iteration (Node 12+ / all modern browsers).
Python (re) code
import re
pattern = re.compile(r"(?:0[1-9]|1[0-2])\/(?:0[1-9]|[12]\d|3[01])\/\d{4}")
input_text = "01/15/2024"
for m in pattern.finditer(input_text):
print(m.group(0))Stdlib `re` module — no third-party dependency. Works on Python 3.6+.
Go (RE2) code
package main
import (
"fmt"
"regexp"
)
func main() {
re := regexp.MustCompile(`(?:0[1-9]|1[0-2])\/(?:0[1-9]|[12]\d|3[01])\/\d{4}`)
input := `01/15/2024`
for _, match := range re.FindAllString(input, -1) {
fmt.Println(match)
}
}Uses `regexp.MustCompile` (panics on bad patterns at startup) and `FindAllString` for all matches.
Pattern
(?:0[1-9]|1[0-2])\/(?:0[1-9]|[12]\d|3[01])\/\d{4} (flags: g)Raw source: (?:0[1-9]|1[0-2])\/(?:0[1-9]|[12]\d|3[01])\/\d{4}
How it works
Examples
Input
01/15/2024Matches
01/15/2024
Input
12/31/1999Matches
12/31/1999
Input
13/01/2024No match
—Common use cases
- •US form date field validation
- •Spreadsheet date column parsing
- •Legacy system data migration
- •Document date extraction
Related patterns
European Date Format (DD/MM/YYYY)
Dates & TimesMatch European-style dates in DD/MM/YYYY format with valid day (01–31) and month (01–12) ranges.
ISO 8601 Date
Dates & TimesMatch dates in ISO 8601 format: YYYY-MM-DD with valid month (01–12) and day (01–31) ranges.
ISO 8601 Date-Time
Dates & TimesMatch full ISO 8601 date-times with timezone offset or Z suffix (e.g. 2024-01-15T14:30:00Z).
Unix Timestamp
Dates & TimesMatch 10-digit Unix timestamps (seconds since epoch) for dates between 2001 and 2286.