Loading...

Build your own grep

Learn about regex syntax: character classes, quantifiers and more

Start Building
grep
Go
grep
Haskell
grep
JavaScript
grep
PHP
grep
Python
grep
Rust
grep
Zig
grep
C++
grep
C#
grep
Kotlin
grep
Java
grep
Gleam
grep
Odin
grep
TypeScript
This challenge is free until 1 October 2025!

Regular expressions (or Regexes) are patterns used to match character combinations in strings. In this challenge, you'll build a Regex engine from scratch by recreating grep, a CLI tool for regex-based searching.

Along the way you'll learn about Regex syntax, character classes, quantifiers and more.

Stages

Match a literal character
Match digits
Match word characters
Positive Character Groups
Negative Character Groups
Combining Character Classes
Start of string anchor
End of string anchor
Match one or more times
Match zero or one times
Wildcard
Alternation

Backreferences

Single Backreference
Multiple Backreferences
Nested Backreferences

File Search

Search a single-line file
Search a multi-line file
Search multiple files
Recursive search