Regular Expressions 101

Community Patterns

Community Library Entry

1

Regular Expression
Python

r"
(?P<sender>sender\d+) postfix.[^-]*-(?P<ip>[^/,]*)/[^:]*: (?P<queue>[^ ]+): (from|to)=<(?P<login>[^@]*)@(?P<domain>[^\.]*)[^>]*>.*(?:status=)(?P<status>\w+)
"
g

Description

get ip identifier, queue name, email domain and status from postfix log

Submitted by kglod - 9 years ago