Regular Expressions 101

Community Patterns

Year/Month/Day parser

0

Regular Expression
PCRE2 (PHP >=7.3)

/
^(?:(\d+)\sYears?)?,?\s?(?:and\s)?(?:(\d+)\sMonths?)?,?\s?(?:and\s)?(?:(\d+)\sDays?)?$
/
gmi

Description

Parse the years/months/days from a string

Submitted by anonymous - 3 years ago