What a Regular Expression Is
From Regex Without Tears
Who it is for: Anyone who has copied a regular expression without understanding it.
Working manuscript · 2027–2028 Edition. The full book is forthcoming; text and illustrations may change.
A regex can fit a large amount of syntax into a short line:
This example is easier to read after it is split into tokens. The ^ and $ constrain positions, bracketed expressions describe allowed characters, + means repetition, and @ is literal text. This chapter first defines the values involved in matching; later chapters explain each token.
Read the chapter
The preview below shows the first 3 pages. The PDF contains the complete 8-page chapter, with selectable text and the original illustrations.
Download sample chapter (PDF) ↓Open PDF in a new tab ↗


Keep exploring Regex Without Tears
Make the punctuation mean something. Watch patterns match real strings, then learn to reason about repetition, captures, and backtracking.
See the book outline →Questions or corrections? support@hackerbrewery.com