Portrait of Michael Limberger

Michael Limberger

Need me? Email mike@limberger.ca

Regex

Regex Therapy - Overview

It looks like line noise. It is not

This talk is regex you can type the same evening. We start with ack, rename, and a few Perl one-liners, then build confidence before the denser PCRE material.

^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$

And their brain says nope.

You do not need to write monsters like that. Most real-world regex is simple. Five or six characters that save you hours of tedious work. Once you learn the basics, you will wonder how you ever lived without them.

Three tools, one syntax

This session teaches regex through three practical tools.

ack searches files for patterns. Like grep, but better for code.

rename bulk-renames files with patterns. perl does one-liner text transformations.

All three use the same regex syntax: Perl-compatible regular expressions (PCRE). Learn it once, use it everywhere.

Tool Job
ack Search
rename Bulk rename
perl Transform text

Same regex syntax under all three.

Why this sits next to local AI

If you are running local AI, you generate a lot of output that needs processing. Vision models return messy, variable text. Image generators create files with ugly default names. Batch processing means hundreds of files to organize. Log files full of data that needs extracting.

Regex is the glue. It is how you parse AI output, rename generated files, and extract the data you actually need. Foundation work for everything we do with local AI pipelines.

The walk tonight

By the end you will know how to search your entire project for specific patterns, find all files containing a word (or not containing it), rename hundreds of files in one command, extract data from messy text, and do find-and-replace on steroids.

We start simple with single characters. Then we build up to patterns that would take you forever to do by hand.

What you need

A terminal (Mac, Linux, or Windows with WSL). A folder with some files to practice on. About an hour of focused time. We will install the tools as we go.

How the notes are laid out

01. Overview (you are here)
02. Installing the Tools
03. Regex Fundamentals · The Building Blocks
04. Regex Fundamentals · Combining Patterns
05. ack · Searching
06. ack · Going further
07. rename · Bulk file operations
08. rename · Capture groups
09. Perl one-liners · The basics
10. Perl one-liners · Real examples
11. A card to keep nearby
12. Practice

Each section builds on the last. Do not skip ahead.