Regular Expressions 101

Community Patterns

Community Library Entry

3

Regular Expression
PCRE (PHP <7.3)

/
(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}) - - \[(\d{2}\/[a-zA-Z]{3}\/\d{4}:\d{2}:\d{2}:\d{2} (\+|\-)\d{4})\] ((\"(GET|POST|HEAD|OPTIONS) )(.+)(HTTP\/1\.(1|0)")) (\d{3}) (\d+) (["]((\-)|(.+))["]) (["](.+)["])
/

Description

parse the apache access log

Submitted by pagu - 9 years ago