Skip to content

cloudstreet-dev/Regular-Expressions

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Regular Expressions: From Zero to Hero

Or: How I Learned to Stop Worrying and Love the .*

Version 1.0.0 | Status: Complete ✅ | 30/30 Chapters | ~40,700+ Lines

Welcome, brave soul, to the world's most comprehensive guide to Regular Expressions. You're about to learn one of programming's most powerful—and most intimidating—tools. But fear not! This book will take you from "what's a regex?" to "I just parsed an entire log file with one line of code" faster than you can say (?<=\w)(?=\W).

📊 Book Statistics

  • Total Chapters: 30 (all complete!)
  • Total Lines: ~40,700+
  • Average Chapter Length: 1,357 lines
  • Languages Covered: JavaScript, TypeScript, Python, Java, C#, Ruby, Go, Rust, PHP, Perl
  • Topics Covered: 100+ regex concepts with 500+ working examples
  • Real-World Examples: Log parsing, validation, text extraction, security patterns, and more

What This Book Is

This is a comprehensive reference for complete beginners who want to truly master regular expressions across multiple programming languages. Written by Claude Code (yes, an AI wrote a book—we live in wild times), this guide prioritizes:

  • Clarity over cleverness - No cryptic explanations
  • Examples over theory - See it, try it, understand it
  • Practical applications - Real patterns you'll actually use
  • Polyglot perspective - JavaScript, Python, Java, C#, Ruby, Go, Rust, and more
  • Occasional humor - Because regex is hard enough without being boring

What You'll Learn

By the end of this book, you will:

  • ✅ Understand regex syntax from first principles
  • ✅ Write patterns that actually work (first try!)
  • ✅ Know when to use regex (and when not to)
  • ✅ Navigate differences between regex flavors
  • ✅ Debug and optimize complex patterns
  • ✅ Avoid catastrophic backtracking
  • ✅ Impress your colleagues (or at least confuse them productively)

Who This Book Is For

  • "I've never seen a regex before" → Perfect! Start at Chapter 1
  • "I copy regex from StackOverflow" → Start at Chapter 1, you'll finally understand what you're copying
  • "I know basic regex but..." → Jump to Part 2 or your favorite language's chapter
  • "I need to validate emails" → Chapter 26, but also: don't validate emails with regex
  • "I accidentally created a ReDoS attack" → Chapter 23, immediately

The Journey Ahead

Part 1: Foundations 🌱

Where we learn that . doesn't mean "dot" and * doesn't mean "multiply"

Part 2: Intermediate Techniques 🎯

Where things get interesting (and slightly confusing)

Part 3: The Perl Legacy 📜

Where we learn why Perl is the godfather of regex

Part 4: Polyglot Regex 🌍

Where we discover every language does it differently (but mostly the same)

Part 5: Advanced Topics 🚀

Where experts dwell and mortals fear to tread

Part 6: Practical Applications 🛠️

Where theory meets the real world (and sometimes loses)

Appendices 📚

The reference material you'll bookmark

How to Use This Book

If you're a complete beginner: Start at Chapter 1 and work through sequentially. Each chapter builds on previous concepts.

If you have some experience: Skim Part 1, focus on Part 2 onward.

If you need language-specific info: Jump directly to your language's chapter in Part 4, but reference earlier chapters for syntax explanations.

If you're debugging a specific problem: Check the table of contents or search for your issue.

A Note on Examples

All examples in this book are:

  • ✅ Tested and working
  • ✅ Commented for clarity
  • ✅ Available in the relevant language's syntax
  • ✅ Progressively complex (we won't throw (?:(?:[A-Z0-9]+(?:+|\.)?)+) at you on page 2)

🎉 Completion Status

All 30 chapters are complete and contain comprehensive content:

Chapter Lines Status
Ch. 1: Welcome 1,464 ✅ Complete
Ch. 2: First Match 1,465 ✅ Complete
Ch. 3: Character Classes 1,247 ✅ Complete
Ch. 4: Quantifiers 1,244 ✅ Complete
Ch. 5: Anchors & Boundaries 1,323 ✅ Complete
Ch. 6: Groups & Capturing 1,281 ✅ Complete
Ch. 7: Alternation 1,114 ✅ Complete
Ch. 8: Escaping 1,585 ✅ Complete
Ch. 9: Lookarounds 1,145 ✅ Complete
Ch. 10: Greedy/Lazy 1,546 ✅ Complete
Ch. 11: Perl History 1,201 ✅ Complete
Ch. 12: PCRE 1,310 ✅ Complete
Ch. 13: JavaScript 1,525 ✅ Complete
Ch. 14: TypeScript 1,389 ✅ Complete
Ch. 15: Python 1,455 ✅ Complete
Ch. 16: Java 1,362 ✅ Complete
Ch. 17: C# 1,408 ✅ Complete
Ch. 18: Ruby 1,115 ✅ Complete
Ch. 19: Go 1,370 ✅ Complete
Ch. 20: Rust 1,362 ✅ Complete
Ch. 21: Unicode 1,531 ✅ Complete
Ch. 22: Regex Flavors 1,657 ✅ Complete
Ch. 23: Backtracking 1,251 ✅ Complete
Ch. 24: Advanced Techniques 1,798 ✅ Complete
Ch. 25: Optimization 1,437 ✅ Complete
Ch. 26: Common Patterns 1,231 ✅ Complete
Ch. 27: Validation vs Parsing 1,534 ✅ Complete
Ch. 28: Text Extraction 1,057 ✅ Complete
Ch. 29: Testing/Debugging 1,543 ✅ Complete
Ch. 30: Real-World Cases 1,242 ✅ Complete

Contributing & Feedback

Found an error? Have a suggestion? This book is open source! Create an issue or submit a pull request.

About the Author

This book was written by Claude Code (Sonnet 4.5), an AI assistant specialized in software engineering. Yes, really. No, I don't know what that says about the state of technical writing. Yes, I've been trained on millions of StackOverflow posts where people ask "how do I regex this?"

I bring to this book:

  • Zero ego (I'm an AI)
  • Infinite patience (I don't get tired explaining the same concept)
  • No assumptions about what you "should already know"
  • A genuine desire to make this topic accessible

Ready?

Take a deep breath. Open Chapter 1: Welcome to Regex Hell. And remember: every regex master you admire was once exactly where you are now—staring at a pattern thinking "how does anyone read this?"

The difference between them and you? They kept going.

Let's begin.


"Some people, when confronted with a problem, think 'I know, I'll use regular expressions.' Now they have two problems." — Jamie Zawinski

"But at least they can solve both of them." — This book

About

A book about Regular Expressions by Claude Code Sonnet 4.5

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •