---
title: "Regex Runner: Regex Practice Puzzles | Aback Games"
description: "Practise regular expressions with 24 puzzles: write a regex that matches one list of strings and skips the other. Checked live as you type, free."
url: https://abackgames.com/games/regex-runner
---

# Regex Runner

Write a regular expression that matches every string on one list and none on the other. 24 puzzles, from anchors to lookarounds.

- Developer game
- Free
- No sign-up
- Keyboard
- Touch

## About Regex Runner

Regular expressions are one of the most useful tools a programmer has, and one of the hardest to learn from a reference page. Regex Runner teaches them the way they are really used: you have some strings you want and some you do not, and you need a pattern that tells them apart.

There are 24 puzzles in three packs. Each shows a list of strings your pattern should match and a list it should not. As you type, every string is marked right or wrong, so you see straight away what each part of your pattern does.

## How to play Regex Runner

1. Choose a pack: Beginner (literals, anchors, classes and counts), Intermediate (groups, alternation, word boundaries) or Advanced (lookarounds and backreferences).
2. Read the task, then type a pattern in the box. Each string gets a tick when it comes out right and a cross when it does not.
3. A puzzle is solved when every string has a tick: all of "Should match" are matched and none of "Should not match" are.
4. Press Enter or Next puzzle to go on. Stuck? Open the hint, or show an answer.

## Regex Runner controls

**Keyboard**

- **Type a pattern**: Type in the pattern box
- **Next puzzle, once solved**: Enter
- **Jump to a puzzle**: Tab to its number and press Enter
- **Sound on or off**: M (outside the pattern box)

**Touch screens**

- **Type a pattern**: Tap the pattern box
- **Next puzzle**: Tap Next puzzle
- **Jump to a puzzle**: Tap its number

## Regex Runner rules

### What counts as a match

Patterns are JavaScript regular expressions with no flags, so matching is case-sensitive. A string counts as matched if the pattern is found anywhere in it, the way RegExp.test works. To match a whole string, pin the pattern with ^ at the start and $ at the end.

### Packs and puzzles

Each pack has 8 puzzles. Beginner covers literal text, anchors, character classes and counts like {3}. Intermediate adds groups, alternation with |, word boundaries and backreferences. Advanced uses lookaheads, lookbehinds and patterns that check whole formats, like dates and IP addresses.

You can play the puzzles in any order. Every puzzle has many right answers; the one shown by Show an answer is only one of them.

### Records

For each puzzle the length of your shortest solving pattern is saved in this browser, and the puzzle number turns green. If you show the answer first, solving that puzzle is not recorded on this visit. Try coming back to a solved puzzle to find a shorter pattern.

### Slow patterns

Some patterns, such as (a+)+$, can take an extremely long time on certain strings because the regex engine tries every way of splitting the text. This is called catastrophic backtracking. Regex Runner stops any pattern that runs for longer than a moment and tells you, so the page never freezes.

## Tips and strategy

- Start with the strings that should not match. They show you what your pattern must avoid, which is usually the hard part.
- Use ^ and $ whenever a puzzle is about a whole string. Without them, a pattern that matches part of a bad string still counts as a match.
- Square brackets match one character from a set: \[aeiou\] is one vowel, \[^aeiou\] is one character that is not a vowel, and \[0-9a-f\] is one hex digit.
- A dot matches any character, so escape it as \\. when you mean a real full stop.
- Counts apply to the thing just before them: \\d{3} is three digits, (ab){2} is abab, and colou?r makes only the u optional.
- A lookahead like (?=.\*\\d) checks that something is there without using up any of the string, so you can stack several checks at the start of a pattern.

## Frequently asked questions

Which regex flavour does Regex Runner use?

JavaScript, as built into your browser, with no flags. Most of what you learn carries over to Python, Java, PHP and other languages; the main differences are in advanced features like lookbehind support and named groups.

What is the best way to practise regular expressions?

Work on small, concrete problems where you can see the result immediately. That is what these puzzles are: each one is a real task, like matching dates or file names, with instant feedback on every string.

Why does my pattern match a string I did not expect?

Usually because the pattern is found somewhere inside it. "cat" matches "concatenate". Add ^ and $, or \\b for a word boundary, to say where the match must start and end.

Is a shorter regex better?

Not always in real code, where clarity matters more. Here the shortest pattern is a fun extra challenge, and finding it usually teaches you something about how the engine works.

## Guides and tips

Developer skills

### [Regular expressions for beginners: a practical guide](https://abackgames.com/guides/regex-for-beginners)

The parts of a regular expression you will use every week, each with a small example, plus the mistakes that catch everyone out.

 4 min read

Developer skills

### [Common coding bugs and how to spot them](https://abackgames.com/guides/common-coding-bugs)

Off-by-one loops, NaN and NULL, falsy zero, shared defaults, sorting surprises and forgotten awaits: what goes wrong and the habit that catches each one.

 4 min read

Developer skills

### [Git branching explained: commit, merge, rebase and reset](https://abackgames.com/guides/git-branching-explained)

What a branch actually is, what HEAD points to, and what merge, rebase, cherry-pick and reset do to the commit graph.

 4 min read

## More games like this

Developer

### [Bug Hunt](https://abackgames.com/games/bug-hunt)

Spot the buggy line in short JavaScript, Python and SQL snippets. 8 a round, with the cause and the fix after each.

- Keyboard
- Touch

Developer

### [Code Typer](https://abackgames.com/games/code-typer)

A typing test for programmers: type real JavaScript, Python, Rust and SQL code against the clock.

- Keyboard
- Touch

Developer

### [Bit Flip](https://abackgames.com/games/bit-flip)

Flip bits to build each number in binary. How many can you make in 60 seconds?

- Keyboard
- Touch

[ All games](https://abackgames.com/games)
