What am I actually solving?
Begin with the data, the boundaries, and the rule instead of reaching immediately for symbols.
A book about patterns and decisions
Learning to see structure through regular expressions
Regex is the subject. Judgment is the lesson.
Learn regular expressions from the ground up, then use them to practice something larger: defining problems, testing assumptions, managing complexity, and choosing the right tool.
# Start with the problem
^ # Find the boundary
(?<structure> # Name what matters
observe # See the problem
| define # Define the problem
| decompose # Figure it out
| verify # Test the solution
#-------------
# Learn to write readable regex, how to think
# about problems, or even just look at me
# attempt to explain recursion.
# ------------
)
$ # Know where to stop
Readable first. Compact later.
The larger lesson
Most regex books teach you how to write patterns. The Shape of Patterns teaches you how to think about a problem and uses regex as a visible, testable way to practice the habits behind mature technical work.
Learn the pattern, not just the syntax
Begin with the data, the boundaries, and the rule instead of reaching immediately for symbols.
Use examples, counterexamples, edge cases, returned spans, and captures to test what the pattern truly promises.
Reason about ambiguity, performance, false positives, false negatives, and operational consequences.
Make intent, assumptions, ownership, and tradeoffs visible enough for another person to understand and change safely.
Understand engines, host operations, compatibility, performance models, and the cost of specialized features.
Compare regex with literal string operations, ordinary code, parsers, libraries, and staged solutions.
A progression toward maturity
You leave with a repeatable way to approach unfamiliar technical problems.
Characters, positions, boundaries, categories, repetition, and readable patterns.
Examples, counterexamples, decomposition, expression, verification, and maintenance.
Code, terminals, editors, logs, security, automation, analytics, spreadsheets, and databases.
Engines, compatibility, backtracking, predictable execution, and performance tradeoffs.
Reliability, tool choice, failure behavior, ownership, restraint, and judgment.
Consider alternative approaches for text processing and pattern matching.
Wherever you are with regex
Build a mental model before the symbols become intimidating. Learn why patterns work, not just what to type.
Stop relearning isolated tricks. Develop a process you can carry from one problem and tool to the next.
Go beyond syntax into engines, performance, maintenance, compatibility, ownership, restraint, and judgment.
The payoff
At first, a complicated regex looks like punctuation. Later, you see components, relationships, boundaries, and decisions. The goal is not to memorize every feature. It is to know how to begin.
“I can figure this out.”
Regex is the vehicle.
Follow the book
I'm writing a book, not starting a regex newsletter. Sign up for publication news and meaningful updates about The Shape of Patterns. I will not email you just because it is Tuesday.