Build your own grep

Learn about regex syntax: character classes, quantifiers and more

Regular expressions (Regexes, for short) are patterns used to match character combinations in strings. grep is a CLI tool for searching using Regexes.

In this challenge you'll build your own implementation of grep. Along the way we'll learn about Regex syntax and how Regexes are evaluated.


Match a literal character
< 5 minutes

In this stage, we'll handle the simplest regex possible: a single character.


a should match "apple", but not "dog".

Match digits
< 5 minutes

In this stage, we'll implement support for the \d character class.

\d matches any digit.


\d should match "1", but not "a".

show all...