Regular Expressions 101

Community Patterns

Community Library Entry

0

Regular Expression
PCRE (PHP <7.3)

%
^\D{8}(?<severity>\w)(?<time>\d{4}\s[^\s]*)\s+(?<pid>\d+)\s+(?<source>[^ \]]+)\](?<message>.*[/\/n])([\W]*[\w]*){3}[\W]{3}(?<logdate>[\d]*\-[\d]*\-[\d]*)\w(?<logtime>[\d]*\:[\d]*\:[\d]*\.[\d]*)\w\W*$
%
mg

Description

Pars such a log: {"log":"I1219 13:32:01.389913 1 server.go:114] Version: v1.8.0\n","stream":"stderr","time":"2017-12-19T13:32:01.390360472Z"}

Submitted by Alireza - 7 years ago