gitwtfhub

wtf is super-expressive?

francisrstokes/super-expressive — explained in plain English

Analysis updated 2026-06-26

4,621JavaScriptAudience · developerComplexity · 2/5Setup · easy

TL;DR

A JavaScript library that lets you build regular expressions by chaining readable method names like .optional and .exactly instead of writing dense symbol-filled regex syntax.

Mindmap

mindmap
  root((repo))
    What It Does
      Builds regex patterns
      Plain English methods
      Converts to JS regex
    API Style
      Method chaining
      Readable names
      Helpful error messages
    Features
      Reusable sub-patterns
      TypeScript support
      Zero dependencies
    Other Languages
      PHP port
      Ruby port
      Python port

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Why would anyone build with this?

REASON 1

Replace a hard-to-read regex in your codebase with a readable super-expressive method chain that your teammates can understand.

REASON 2

Define a reusable sub-pattern for email or URL validation and compose it into multiple larger form validators.

REASON 3

Port a JavaScript regex to PHP or Python using one of the community-contributed super-expressive language ports.

What's in the stack?

JavaScriptTypeScript

How it stacks up

francisrstokes/super-expressivepaulmillr/encrypted-dnsmholt/json-to-go
Stars4,6214,6214,622
LanguageJavaScriptJavaScriptJavaScript
Setup difficultyeasyeasyeasy
Complexity2/51/51/5
Audiencedevelopergeneraldeveloper

Figures from each repo's GitHub metadata at analysis time.

How do you spin it up?

Difficulty · easy Time to first run · 5min

Wtf does this do

Super Expressive is a JavaScript library that lets you build regular expressions by chaining plain-English method names instead of writing the terse symbol-heavy syntax that regular expressions normally require. Regular expressions are patterns used in code to find, match, or validate text, but their compact notation is notoriously hard to read and remember. This library offers an alternative way to write them that is easier to understand and review. Instead of writing something like /^(?:0x)?([A-Fa-f0-9]{4})$/, you chain methods like .startOfInput, .optional.string('0x'), .exactly(4).anyOf, and .endOfInput to describe the same pattern step by step. The resulting object can be converted to a standard JavaScript regex at the end, so it works with everything that already uses regular expressions. The library has no dependencies and weighs less than 4kb. The API is designed to be discoverable: method names describe what they do in plain terms, order follows how you would read the rule in English, and the library gives helpful error messages if you chain something incorrectly. You can also define reusable sub-patterns and compose them into larger expressions, which is useful when the same matching rule appears in multiple places. The library includes full TypeScript support and has been ported to PHP, Ruby, and Python by community contributors. A browser-based playground is available for testing patterns interactively without writing any code. The README covers the full API with short code examples for every method, including flags like case-insensitive matching, multiline mode, and Unicode support.

Yoink these prompts

Prompt 1
Using super-expressive, write a pattern that matches a hex color code like #A1B2C3 or the shorthand #fff.
Prompt 2
Convert this regex to super-expressive so it is easier to read and maintain: /^[\w.-]+@[\w.-]+\.[a-z]{2,6}$/i
Prompt 3
Show me how to define a reusable named sub-pattern in super-expressive and reference it multiple times in one expression.
Prompt 4
Generate a super-expressive chain that matches a US phone number in formats like 123-456-7890 or 123 456 7890 or 1234567890.

Frequently asked questions

wtf is super-expressive?

A JavaScript library that lets you build regular expressions by chaining readable method names like .optional and .exactly instead of writing dense symbol-filled regex syntax.

What language is super-expressive written in?

Mainly JavaScript. The stack also includes JavaScript, TypeScript.

How hard is super-expressive to set up?

Setup difficulty is rated easy, with roughly 5min to a first successful run.

Who is super-expressive for?

Mainly developer.

View the repo → Decode another repo

This repo across BitVibe Labs

Don't trust strangers blindly. Verify against the repo.