New blogMaking an AI Agent You Can Trust With Money

★ Patterns that are actually tested

Regex Library & Tester

29 battle-tested patterns, from email and UUID to PAN, GSTIN and UPI IDs, plus a tester that explains your regex in plain English and won't freeze your tab on a bad one.

  • Runs in your browser
  • No signup

Test any regex

Read it in plain English (best-effort)

  • [\w.+-]one character from: word character (letter, digit or _), '.', '+', '-'
  • +one or more of the previous
  • @the character '@'
  • [\w-]one character from: word character (letter, digit or _), '-'
  • +one or more of the previous
  • (?:start a group (not captured)
  • .the character '.'
  • [\w-]one character from: word character (letter, digit or _), '-'
  • +one or more of the previous
  • )end of group
  • +one or more of the previous

One sample per line works well with the m flag on anchored patterns.

Waiting for a pattern
01

Pattern library

Every pattern below has its own page with should-match and shouldn't-match samples, a token-by-token explanation, code in JavaScript, Python, Go and Java, and a note on when not to use regex at all. Each one passes all its samples in both JavaScript and Python.

Web

URLs, domains, emails and markup

Identity & contact

Phones, postcodes, usernames, cards

Dev formats

UUIDs, dates, versions, tokens

India

PAN, GSTIN, IFSC, UPI and more
02

Regex cheat sheet

Regex cheat sheet
SyntaxMeans
^ $Start and end of the string (or line, with the m flag)
.Any character except a newline (any character with the s flag)
\d \w \sA digit, a word character, whitespace
\D \W \SThe opposite of each
[abc] [a-z]One character from a set or range
[^abc]One character NOT in the set
* + ?Zero or more, one or more, optional
{3} {2,5} {2,}Exactly 3, between 2 and 5, 2 or more
*? +?Lazy: match as few as possible
(…)Capture group
(?:…)Group without capturing
(?<name>…)Named capture group
a|ba or b
(?=…) (?!…)Lookahead: followed by / not followed by (not in Go's RE2)
\bWord boundary
\1Backreference to group 1 (not in Go's RE2)
03

Why a bad regex can take down a server

JavaScript, Python, Java and most other languages use backtracking engines. Give one a pattern with nested quantifiers like (a+)+$ and an input that almost matches, and it tries every way to split the input before giving up. That's exponential: 30 characters can take seconds, 40 can take hours. Attackers use this to freeze servers. It's called ReDoS.

This tester runs your pattern in a separate worker and kills it after 300ms. In production, avoid nested quantifiers, cap input length before matching, or use a linear-time engine like Go's RE2 or Rust's regex crate, which can't backtrack at all.

04

Questions engineers actually ask

Is my test text sent anywhere?
No. The tester runs entirely in your browser, inside a Web Worker. Nothing you type leaves the page.
Which regex flavour does the tester use?
JavaScript's. Each library page also gives Python, Go and Java versions and flags where Go's RE2 engine needs a different approach, because RE2 has no lookarounds or backreferences.
What is catastrophic backtracking?
Some patterns, usually nested quantifiers like (a+)+, make a backtracking engine try an exponential number of paths on input that almost matches. The tester stops any run after 300ms, so a bad pattern can't freeze your tab. In production, that same pattern can take down a server (a ReDoS attack).
Are these patterns safe to use in production?
They're tested against the sample inputs on each page in JavaScript and Python, and they avoid nested quantifiers. Format checks are still only format checks: each page says what to verify another way.
Should I validate with regex on the client or the server?
Both. Client-side regex gives instant feedback; the server must re-validate, because anyone can bypass the browser.
05

More from the workbench

Fine print

Tools: on the house.
Engineer: by the hour.

The regex was free. Code that doesn't need one is the upgrade: typed schemas, validated once at the edge, trusted everywhere after.

I'm Himanshu, an AI and full-stack engineer. I build MVPs, AI agents and the growth plumbing around them for early-stage startups.