Regular Expressions 101

Community Patterns

Remove Package Connection data from screen.log

1

Regular Expression
Python

r"
(^(\d+%((?!\r\n)\s+))(\[((\w+)((\-\w+)?((?!\r\n)\s+)?(\w+)?((?!\r\n)\s+)?(\d+)?(\,)?(\d+)?(\.)?(\d?)((?!\r\n)\s+)?(k?B)?)?((?!\r\n)\s+)?(\w+)?\]))?(((((?!\r\n)\s+)\[)(.+)\])*(((?!\r\n)\s+)(\[)(.+))?(\r?\n)))
"
gm

Description

From the Linux Screen.print method, after recording a log which involves some apt-getting, we want to find and trim out all that fat.

This is Part 1

Submitted by anonymous - 8 years ago