Regular Expressions 101

Community Patterns

Community Library Entry

1

Regular Expression
PCRE2 (PHP >=7.3)

/
(?:\b(?P<month>0?[1-9]|0?1[012])[\/-](?P<day>0?[1-9]|[12][0-9]|3[01])[\/-](?P<year>\d{2,4})\b)|(?:(?P<month1>0?[1-9]|1[012])[\/](?P<year1>\d{4})\b)|(?:\b(?P<month2>Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)[a-z]{0,6}[. \/-]+(?P<day2>0?[1-9]|[12][0-9]|3[01])(?:th|st|nd)?[ ,\/-]+(?P<year2>\d{2,4})\b)|(?:\b(?P<day3>0?[1-9]|[12][0-9]|3[01])[ ,\/-]+(?P<month3>Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)[a-z]{0,6}[,. \/-]+(?P<year3>\d{2,4})\b)|(?:(?P<month4>Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)[a-z]{0,6}[,. \/-]+(?P<year4>\d{2,4})\b)|(?:(?P<year5>[12]\d{3})\b)
/
gm

Description

Matching date patterns for coursera text mining assignment 1.

Submitted by CodeZ - 2 years ago (Last modified 2 years ago)