Example - Named Capture Groups
Learn how to use named capture groups with static type inference in TS-Rex. See how .capture() provides type-safe match results.
Example - Global Matching & Iteration
Learn how to use the .global() flag in TS-Rex to iterate over all matches in a string safely and statelessly.
Example - Alternation with .or()
Explore how to use alternation in TS-Rex with the .or() method. Understand how the type system models mutual exclusivity with union types.
Example - Real-world URL Parser
A comprehensive example of building a URL parser using TS-Rex. Demonstrates nested captures, optionality, and character class composition.
Example - Basic Capturing
A simple example of using .capture() to extract data from strings with full TypeScript type safety.