About this regex golf game
Regex golf is a puzzle where you write the shortest regular expression that matches every string in one list and none in the other. It is a fun way to practise character classes, anchors, alternation, quantifiers and lookarounds, with your score tracked by pattern length.
How to use the Regex Golf
- Read the match and no-match lists.
- Type a regex; matches update live.
- Shorten the pattern to lower your score.
Example
Match: foo, food, fool · Avoid: bar, baz → ^f
Frequently asked questions
Which regex flavour is used?
JavaScript regular expressions, which support lookahead, lookbehind, named groups and Unicode classes.
Does a shorter regex always win?
Yes, as long as it matches all required strings and none of the excluded ones.
Is my data safe?
Yes. The tool runs entirely in your browser using WebAssembly. Nothing you type or upload is sent to a server, logged or stored.
Is it free?
Yes, completely free with no sign-up, no limits and no watermarks. It also works offline once the page has loaded.