Regular Expressions 101

Community Patterns

Community Library Entry

1

Regular Expression
PCRE (PHP <7.3)

/
(?<dayname>[A-Za-z]{3})\s(?<month>[A-Za-z]{3})\s(?<dayofmonth>\d{2})\s(?<hour>\d{2}):(?<minutes>\d{2}):(?<seconds>\d{2})(?:\.(?<milliseconds>\d*))?\s(?<year>\d{4})
/
i

Description

Parse the date from an Apache Error Log in the format of "Wed Jun 01 20:05:21.12345 2016"

Submitted by garys - 9 years ago