Regular Expressions 101

Community Patterns

Common log format datetime

1

Regular Expression
ECMAScript (JavaScript)

/
(\d{2})\/(\S+)\/(\d{4}):(\d{2}):(\d{2}):(\d{2})\s[+\-](\d{4})
/

Description

Parses the common log format into component elements. According to wikipedia, common log is strftime format %d/%b/%Y:%H:%M:%S %z

Submitted by Matt Ingenthron <ingenthr@cep.net> - 9 years ago