Skip to content

grep & Regular Expressions

grep is the workhorse of log analysis, config auditing, and codebase searching. Paired with regular expressions, it turns unstructured text into actionable data. This topic builds fluency from basic pattern matching through advanced regex features like lookaheads, backreferences, and PCRE extensions.

Contents

Start with the primer for core regex and grep usage, then apply techniques and learn the traps.

# File What it covers
1 Primer BRE vs ERE vs PCRE, character classes, quantifiers, anchors, and grep flags
2 Anti-Primer Regex misconceptions — greedy vs lazy, multiline pitfalls, and when not to use regex
3 Street Ops Real-world patterns for log parsing, IP extraction, config validation, and recursive search
4 Footguns & Pitfalls Locale-dependent character classes, catastrophic backtracking, and quoting surprises