Regular Expressions 101

Community Patterns

Community Library Entry

-1

Regular Expression
PCRE2 (PHP >=7.3)

/
(?<year>\d{4})(?<month>\d{1,2})(?<day>\d{1,2})
/
gm

Description

Convert numbers-only YYYYMMDD date to dash delineated YYYY-MM-DD

Submitted by anonymous - 2 years ago