All languages

Python for DevOps

You're viewing a free preview. Sign in free to read every script.

Why this exists Logs, command output, version strings and config lines are text with a shape , and a regular expression describes a shape. Python's re module is in the standard library and used by nearly every parsing…

Python for DevOps: Regular Expressions for Log Parsing, Masking Secrets and Avoiding ReDoS

Extract fields from log lines with named groups and re.VERBOSE, tell match from search from fullmatch, understand findall's tuples, escape variables, use MULTILINE, mask secrets before logging, and see catastrophic backtracking make a regex explode in time.

Sign in free to read this script, along with the rest of the library.

Sign in free