Regex Practice Exercises
Solve twenty-two graded regular expression exercises with a live check against sample texts and hints, from plain words to groups, back-references and lookarounds.
- Free
- No sign-up
- Works on any device
About Regex Practice Exercises
Learn regular expressions by solving small, graded puzzles. Each of the 22 exercises states a task, such as matching a time like 09:45 or a repeated word, and lists sample texts that must match and others that must not. Type your pattern and the page checks it live against every sample, shows what your pattern returns next to what was expected, and tells you when all tests pass. The levels run from plain words and character classes through quantifiers and anchors to groups, back-references and lookahead. Hints and one worked solution are a click away. It uses JavaScript regular expressions.
How to use Regex Practice Exercises
- Pick an exercise and read the task and the sample texts.
- Type your regular expression, without slashes, and watch the table of tests turn from crosses to ticks.
- Use Show a hint if you are stuck, then Next exercise once all tests pass; compare with Show a solution afterwards.
Why use this tool?
- Private: everything happens in your browser. Nothing you enter is uploaded.
- Free, with no sign-up, no watermark and no limit on how often you use it.
- Works on phones, tablets and computers: Android, iPhone, Windows, Mac and Linux. Nothing to install.
- Free to embed on your own website, with a ready-made code to copy.
Also known as
Frequently asked questions
Do I include the slashes around the pattern?
No. Type only the pattern, for example \d+ for one or more digits, not /\d+/. Use the ignore case tick if you want the i flag.
Why does a pattern match a text I thought it should reject?
A pattern without anchors matches anywhere inside the text. Add ^ for the start and $ for the end, or use \b for word edges, when the whole text must fit the pattern.
Will my solution work in Python or other languages?
The basics are the same, but this page uses JavaScript's engine. Lookbehind, named groups and flags differ between languages, so test the pattern in your own language before you rely on it.
Is Regex Practice Exercises free?
Yes. Regex Practice Exercises on Toolipedia is free to use, with no sign-up and no watermark.
Is it safe to use?
Yes. Everything is worked out in your browser, and nothing you enter is sent to our server.
Does it work on my phone?
Yes. It works in any modern browser on Android and iPhone, as well as on tablets and computers. There's nothing to install.
Do I need an account?
No. Just open the page and use the tool. There's no sign-up and no email needed.
Can I put Regex Practice Exercises on my own website?
Yes. Use the Embed on your site button under the tool to copy a short piece of code and paste it into your page. It is free, needs no account, and the tool keeps working inside your page.