Elofyn

Elofyn · Games · Regex Golf

32 puzzles · v1

Regex Golf.

Write a regex. Match every target. Reject every forbidden word. Shortest pattern wins. 32 hand-curated puzzles, easy to hard, plus a fresh daily challenge.

All puzzles

0/32 solved

  • #01

    Foo Prefix

  • #02

    Two Letters

  • #03

    Double O

  • #04

    Has Digit

  • #05

    -ing Suffix

  • #06

    Hash Line

  • #07

    Lines with Tab

  • #08

    -and Suffix

  • #09

    Starts Uppercase

  • #10

    Exactly 3 Chars

  • #11

    Binary Only

  • #12

    https(s)

  • #13

    qu Cluster

  • #14

    US Phone

  • #15

    Ends in Digit

  • #16

    Markdown Heading

  • #17

    CSS Class

  • #18

    Short Git SHA

  • #19

    Email Shape

  • #20

    No Vowels

  • #21

    YYYY-MM-DD

  • #22

    Hex Color

  • #23

    SemVer

  • #24

    Exactly 4 Digits

  • #25

    Not Start Vowel

  • #26

    Has Uppercase

  • #27

    IPv4 Basic

  • #28

    All Caps

  • #29

    Palindrome

  • #30

    Repeated Word

  • #31

    Image Extension

  • #32

    Between Tags

Puzzle #1Foo Prefix

optimal: 3 chars

// Target — must ALL match

foofoobarfoodfoolish

// Forbidden — NONE may match

oofbarbooflu

Tip: tap and hold keys or use the Regex Chars toolbar for special characters

Regex flagseach active flag adds 2 chars to score
Score: chars
Optimal: 3 chars

Your input never leaves your browser.

What is this?

Regex Golf distills the everyday pattern-matching skill into a focused, score-driven challenge: write the shortest regular expression that matches every word in the TARGET list while failing to match any word in the FORBIDDEN list. Each character you type costs one point — the lower your final score, the sharper your regex thinking. A live preview colors each target green the moment your pattern captures it, and lights forbidden words red if your pattern accidentally matches them, giving you instant feedback as you refine.

The format was popularized by xkcd #1313 in 2014, which challenged readers to write regexes separating US president names from other words. This version brings 32 hand-curated puzzles ranked easy to hard, plus a fresh daily challenge seeded by UTC date — the same puzzle worldwide every day. No account required; the regex engine runs in a sandboxed Web Worker in your browser with a 100ms timeout against catastrophic backtracking.

Read the full explainer →