Regular Expressions 101

Community Patterns

Date Format

0

Regular Expression
ECMAScript (JavaScript)

/
\d{1,2}-\d{1,2}-\d{4}
/

Description

This will check for a date using the format xx-xx-yyyy. The reason the first two groupings are labeled with 'xx' is because we can't be sure which is the month or the date as it will look for both formats and match true. This can also be used in conjunction with ?<date>, ?<month>, and ?<year> to better search for specific date formats.

Submitted by anonymous - 5 years ago