Regex Golf - Free Online Tool | PivaBox

A puzzle game where you write the shortest regex to match target strings — beat the par score across 10 levels!

Regex Golf — Master Regular Expressions Through an Addictive 10-Level Puzzle Game Where You Write the Shortest Possible Pattern

  1. Each level presents two lists: strings that your regex must match (shown in green) and strings it must not match (shown in red). Read the level description carefully — it often contains subtle clues about pattern requirements. Regex Golf is modeled after the classic code golf concept, where the challenge is achieving correct functionality with the fewest possible characters. Your job is to craft a single regular expression that perfectly discriminates between the two sets — matching all 'match these' strings while rejecting all 'don't match these' strings.
  2. Type your regular expression into the input field. As you type, the tool instantly evaluates your pattern against every string in both lists — green highlights mark correctly matched strings, red highlights flag incorrect results (either false positives that should not match or false negatives that should). This real-time feedback loop is designed to help you learn regex syntax through experimentation — you can see immediately whether your anchors (^ and $), character classes ([aeiou]), quantifiers (*+?{}), groups ((...)), and lookarounds ((?=...)) are behaving as expected.
  3. Compare your solution's length against the par score displayed for each level — par represents the character count of an optimal or near-optimal solution. Scoring works like golf: fewer characters than par earns a Birdie 🐦, equal to par is Par, and more characters is a Bogey. Don't worry if your first solution is longer — the real learning happens when you refine and shorten your regex after seeing it work. Complete all 10 levels to win, and feel free to revisit earlier levels to improve your score. Your progress is saved in browser local storage so you can continue anytime.

Frequently Asked Questions

What regex skills will I learn by playing Regex Golf, and is it suitable for beginners?

Regex Golf progressively introduces regular expression concepts across its 10 levels, making it accessible to beginners while still challenging for experienced developers. Early levels focus on basic character classes and anchors — you'll learn to use <code>^</code> (start of string), <code>

PivaBox - Free Online Browser Tools

265+ free online tools for image processing, PDF editing, text manipulation, developer utilities, and more. All tools run entirely in your browser — your files never leave your device. Privacy-first, zero server uploads.

Image Tools

  • Image Converter — Convert images between PNG, JPEG, WebP, and AVIF
  • Image Compressor — Compress and resize images with quality control
  • Image Crop — Crop images interactively
  • Image Filter — Apply grayscale, sepia, blur, and more
  • SVG to PNG — Convert SVG vector graphics to PNG
  • Icon Generator — Generate icons from text and emoji
  • Image to Text (OCR) — Extract text from images
  • Color Picker — Pick colors from images
  • Meme Generator — Add captions to images

PDF Tools

  • PDF Image Extractor — Extract images from PDF files
  • PDF Merger — Merge multiple PDFs into one
  • PDF Splitter — Split PDFs into separate pages
  • PDF to Text — Extract text from PDF files
  • PDF Metadata — View PDF document properties

Text Tools

  • Text Diff — Compare two texts side by side
  • Markdown Preview — Write Markdown and preview HTML
  • Case Converter — Convert text case styles
  • Word Counter — Count characters, words, sentences
  • Lorem Ipsum — Generate placeholder text
  • Text Sorter — Sort, deduplicate, reverse, shuffle

Developer Tools

  • JSON Formatter — Format, validate, minify JSON
  • Regex Tester — Test regular expressions in real-time
  • UUID Generator — Generate UUID v4 identifiers
  • Hash Generator — Compute SHA-1, SHA-256, SHA-384, SHA-512
  • JWT Decoder — Decode JWT tokens
  • YAML ↔ JSON — Convert between YAML and JSON
  • Timestamp Converter — Convert Unix timestamps to dates
  • Base64 Encoder/Decoder — Encode/decode Base64
  • URL Encoder/Decoder — Encode/decode URL strings
  • Slug Generator — Convert text to URL slugs
  • Morse Code — Convert text to/from Morse code
  • Color Converter — Convert between HEX, RGB, HSL
  • Base Converter — Convert between binary, octal, decimal, hex
  • HTML Encoder/Decoder — Encode/decode HTML entities
  • JSON ↔ CSV — Convert between JSON and CSV
  • Password Generator — Generate strong passwords
  • CSS Generator — Generate box-shadow and gradient CSS
  • Cron Parser — Parse cron expressions

Other Tools

  • QR Code — Generate and decode QR codes
  • Unit Converter — Convert length, weight, temperature, area
lt;/code> (end of string), and simple patterns like <code>[aeiou]</code> for vowel matching. Middle levels introduce quantifiers (<code>*</code> for zero-or-more, <code>+</code> for one-or-more, <code>?</code> for optional), alternation with <code>|</code>, and negation with <code>[^...]</code>. Advanced levels require lookaheads and lookbehinds (<code>(?=...)</code> and <code>(?&lt;=...)</code>), backreferences (<code>\1</code>), and non-capturing groups (<code>(?:...)</code>). Each level includes a <strong>Hint</strong> button that provides guidance without giving away the full solution. The PivaBox Regex Golf game runs entirely in your browser — no ads, no tracking, no account needed.

How does Regex Golf scoring work, and what strategies help achieve birdie scores?

The scoring system counts the total characters in your regex pattern. Par is set at a carefully chosen reference length — typically a clean, efficient solution that uses standard regex features without excessive trickery. To achieve Birdie scores, focus on these optimization strategies: (1) <strong>Character class shorthand</strong> — use <code>\d</code> instead of <code>[0-9]</code>, <code>\w</code> instead of <code>[a-zA-Z0-9_]</code>. (2) <strong>Anchors</strong> — using <code>^</code> and <code>

PivaBox - Free Online Browser Tools

265+ free online tools for image processing, PDF editing, text manipulation, developer utilities, and more. All tools run entirely in your browser — your files never leave your device. Privacy-first, zero server uploads.

Image Tools

  • Image Converter — Convert images between PNG, JPEG, WebP, and AVIF
  • Image Compressor — Compress and resize images with quality control
  • Image Crop — Crop images interactively
  • Image Filter — Apply grayscale, sepia, blur, and more
  • SVG to PNG — Convert SVG vector graphics to PNG
  • Icon Generator — Generate icons from text and emoji
  • Image to Text (OCR) — Extract text from images
  • Color Picker — Pick colors from images
  • Meme Generator — Add captions to images

PDF Tools

  • PDF Image Extractor — Extract images from PDF files
  • PDF Merger — Merge multiple PDFs into one
  • PDF Splitter — Split PDFs into separate pages
  • PDF to Text — Extract text from PDF files
  • PDF Metadata — View PDF document properties

Text Tools

  • Text Diff — Compare two texts side by side
  • Markdown Preview — Write Markdown and preview HTML
  • Case Converter — Convert text case styles
  • Word Counter — Count characters, words, sentences
  • Lorem Ipsum — Generate placeholder text
  • Text Sorter — Sort, deduplicate, reverse, shuffle

Developer Tools

  • JSON Formatter — Format, validate, minify JSON
  • Regex Tester — Test regular expressions in real-time
  • UUID Generator — Generate UUID v4 identifiers
  • Hash Generator — Compute SHA-1, SHA-256, SHA-384, SHA-512
  • JWT Decoder — Decode JWT tokens
  • YAML ↔ JSON — Convert between YAML and JSON
  • Timestamp Converter — Convert Unix timestamps to dates
  • Base64 Encoder/Decoder — Encode/decode Base64
  • URL Encoder/Decoder — Encode/decode URL strings
  • Slug Generator — Convert text to URL slugs
  • Morse Code — Convert text to/from Morse code
  • Color Converter — Convert between HEX, RGB, HSL
  • Base Converter — Convert between binary, octal, decimal, hex
  • HTML Encoder/Decoder — Encode/decode HTML entities
  • JSON ↔ CSV — Convert between JSON and CSV
  • Password Generator — Generate strong passwords
  • CSS Generator — Generate box-shadow and gradient CSS
  • Cron Parser — Parse cron expressions

Other Tools

  • QR Code — Generate and decode QR codes
  • Unit Converter — Convert length, weight, temperature, area
lt;/code> can eliminate the need for long negative patterns. (3) <strong>Lookaheads</strong> — <code>(?=.*foo)</code> can assert a condition without consuming characters. (4) <strong>Minimize alternation</strong> — <code>[aeiou]</code> (7 chars) beats <code>a|e|i|o|u</code> (9 chars) for single-character alternation. (5) <strong>Leverage negation</strong> — sometimes describing what NOT to match (<code>^[^x]*

PivaBox - Free Online Browser Tools

265+ free online tools for image processing, PDF editing, text manipulation, developer utilities, and more. All tools run entirely in your browser — your files never leave your device. Privacy-first, zero server uploads.

Image Tools

  • Image Converter — Convert images between PNG, JPEG, WebP, and AVIF
  • Image Compressor — Compress and resize images with quality control
  • Image Crop — Crop images interactively
  • Image Filter — Apply grayscale, sepia, blur, and more
  • SVG to PNG — Convert SVG vector graphics to PNG
  • Icon Generator — Generate icons from text and emoji
  • Image to Text (OCR) — Extract text from images
  • Color Picker — Pick colors from images
  • Meme Generator — Add captions to images

PDF Tools

  • PDF Image Extractor — Extract images from PDF files
  • PDF Merger — Merge multiple PDFs into one
  • PDF Splitter — Split PDFs into separate pages
  • PDF to Text — Extract text from PDF files
  • PDF Metadata — View PDF document properties

Text Tools

  • Text Diff — Compare two texts side by side
  • Markdown Preview — Write Markdown and preview HTML
  • Case Converter — Convert text case styles
  • Word Counter — Count characters, words, sentences
  • Lorem Ipsum — Generate placeholder text
  • Text Sorter — Sort, deduplicate, reverse, shuffle

Developer Tools

  • JSON Formatter — Format, validate, minify JSON
  • Regex Tester — Test regular expressions in real-time
  • UUID Generator — Generate UUID v4 identifiers
  • Hash Generator — Compute SHA-1, SHA-256, SHA-384, SHA-512
  • JWT Decoder — Decode JWT tokens
  • YAML ↔ JSON — Convert between YAML and JSON
  • Timestamp Converter — Convert Unix timestamps to dates
  • Base64 Encoder/Decoder — Encode/decode Base64
  • URL Encoder/Decoder — Encode/decode URL strings
  • Slug Generator — Convert text to URL slugs
  • Morse Code — Convert text to/from Morse code
  • Color Converter — Convert between HEX, RGB, HSL
  • Base Converter — Convert between binary, octal, decimal, hex
  • HTML Encoder/Decoder — Encode/decode HTML entities
  • JSON ↔ CSV — Convert between JSON and CSV
  • Password Generator — Generate strong passwords
  • CSS Generator — Generate box-shadow and gradient CSS
  • Cron Parser — Parse cron expressions

Other Tools

  • QR Code — Generate and decode QR codes
  • Unit Converter — Convert length, weight, temperature, area
lt;/code>) is shorter than describing what to match. The built-in Hint system nudges you toward these techniques without spoiling the puzzle.

Is Regex Golf just a game, or does it have practical value for developers learning regex?

Regex Golf is deliberately designed as a learning tool disguised as a game. Unlike dry regex tutorials that explain syntax without context, each level presents a concrete challenge that requires a specific regex technique. This problem-first learning approach mirrors how developers actually use regex in practice — you encounter a real string-matching challenge and need to craft the right pattern. The instant visual feedback (green/red highlighting) creates a tight experimentation loop that's far more effective than reading documentation alone. Many professional developers credit regex puzzle games with helping them internalize advanced concepts like lookarounds and backreferences that are notoriously difficult to learn from reference manuals. After completing all 10 levels, you'll have practical experience with the most commonly used regex features and a better intuition for pattern optimization. And yes — it's genuinely fun. The PivaBox Regex Golf game saves your progress locally and requires no account or installation.