Regular Expressions 101

Community Patterns

Specific Year Dates (Regular Expression)

1

Regular Expression
Java 8

"
^(2010)[- /.](0[1-9]|1[012])[- /.](0[1-9]|[12][0-9]|3[01])$|(^[0-3]?[0-9].[0-3]?[0-9].(2010)$)
"
gm

Description

Here's a regular expression to handle a specific year in the different forms of dates:

YYYY-MM-DD DD-MM-YYYY MM-DD-YYYY

Submitted by loganmcampbell - 2 years ago