Puzzles That Reveal How Regex Thinks—and How AI Does, Too
Regular expressions are a staple of every programmer’s toolkit, but mastering their quirks often feels like solving a riddle. In Regular Expression Puzzles and AI Coding Assistants, David Q. Mertz presents 24 carefully crafted puzzles that probe the edges of regex capability. What makes this collection unique is the side-by-side comparison: for each puzzle, you see Mertz’s own solution and the response from AI coding assistants like Copilot, ChatGPT, and others.
It’s not just a test of regex skill—it’s an exploration of how humans and machines approach pattern matching, where AI shines, and where it stumbles.
Inside the Puzzle Collection 🧩
The puzzles span a wide range of difficulty and domain, from simple wildcard scope and word boundaries to advanced topics like catastrophic backtracking, matching prime numbers, and even reimplementing Python’s (). Each puzzle is framed with a clear goal, and the solutions dive into the regex engine’s behavior.
- Quantifiers, groups, and backreferences
- Lookahead and lookbehind assertions
- Performance pitfalls and possessive quantifiers
- Applying regex to real-world tasks like poker hand evaluation and IPv4 validation
An appendix provides a concise regex tutorial, making the book accessible even if your regex skills are a bit rusty.
Author vs. AI: A Revealing Contrast 🤖
Mertz’s commentary on each AI attempt is candid and insightful. You’ll see where the AI nails a solution and where it produces something plausible but subtly wrong. These moments aren’t just entertaining—they highlight the current strengths and limitations of AI-assisted coding. For developers curious about integrating AI into their workflow, the book offers practical lessons on when to trust the machine and when to rely on your own understanding.
Who Will Benefit from These Puzzles 💻
If you write code regularly—whether in Python, JavaScript, or any language with regex support—you’ll find these puzzles sharpen your ability to reason about patterns. The book is especially valuable for:
- Programmers who want to deepen their regex fluency
- Developers evaluating AI coding assistants for real-world tasks
- Computer science students studying formal languages and pattern matching
- Anyone preparing for technical interviews where regex questions appear
You don’t need to be a regex guru to start. The puzzles are self-contained, and the appendix covers the fundamentals. But be prepared to think—these aren’t fill-in-the-blank exercises.
Why This Book Stands Out
Most regex books are references or tutorials. This one is a workout. By presenting puzzles and comparing human and AI solutions, it turns learning into an active, sometimes humbling, but always engaging experience. The author’s dry wit and deep expertise shine through, making even the trickiest concepts approachable.
Whether you’re a seasoned developer looking for a mental challenge or an AI enthusiast curious about its coding abilities, Regular Expression Puzzles and AI Coding Assistants offers a fresh perspective on two intertwined subjects.
User Reviews
Be the first to review “Regular Expression Puzzles and AI Coding Assistants”
You must be logged in to post a review.
Original price was: $5.00.$2.50Current price is: $2.50.

There are no reviews yet.