Regular Expressions 101

Community Patterns

Community Library Entry

-4

Regular Expression
PCRE (PHP <7.3)

/
^(20|21)[0-9]{2}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$
/
date php

Description

Date with this format YYYY-MM-DD and year start 20 or 21 like 2014

Submitted by cisc0 - 11 years ago