formatter.input
Global: Find all matches, not just the first.
Ignore Case: Match letters regardless of case.
Multiline: ^ and $ match start/end of each line.
DotAll: . matches newline (\n) as well as any character.
Unicode: Enable full Unicode matching.
Sticky: Match only from the last index (advanced).
formatter.output

validator.regex.noResults

Regex Validator — Test, Debug & Understand Regular Expressions in Real Time

Regex is the only programming tool where writing it and reading it feel like completely different skills.

You can spend twenty minutes crafting a pattern that perfectly matches everything it should — then discover six months later that someone else on your team can't tell what it does. Or that it works perfectly in Python but fails silently in JavaScript because the two engines handle it differently.

Paste your pattern and test strings above. See matches highlighted in real time. See every captured group. See exactly where the pattern succeeds and where it breaks — before it breaks in production.

Why Regex Is Uniquely Hard to Get Right

Most programming constructs have a learning curve that levels off. Regex never fully levels off — even experts reach for a tester for anything beyond trivial patterns.

It's dense by design

Patterns like ^(?=.*[A-Z])(?=.*\d).{8,}$ pack enormous meaning into compact syntax. They are nearly unreadable at first glance.

Engine differences

JavaScript regex, Python `re`, Java `Pattern`, and PCRE all share core syntax but diverge on lookbehinds, named groups, and unicode.

Performance is hidden

Certain patterns fail slowly. ReDoS (Regular Expression Denial of Service) can turn a harmless pattern into a server-crashing vulnerability.

Edge cases are invisible

Empty strings. Unicode characters. Multi-line input. The inputs you didn't test are always the ones that reveal the holes.

What Our Regex Validator Does

Real-Time Highlighting

Matches are highlighted instantly as you type. No submit button. See immediately what matches and what doesn't.

Capture Group Display

See exactly what `$1`, `$2`, and named groups captured. Critical for data extraction patterns.

Multi-Flavor Support

Test against the actual engine you use: JavaScript, Python, PCRE (PHP), Java, or Go.

Flag Controls

Toggle flags interactively: global (g), case-insensitive (i), multiline (m), dotAll (s).

Match Count & Position

See total match count and exact start/end positions for every match found.

Error Detection

Catches syntax errors immediately — unclosed groups, invalid escapes — with clear explanations.

Regex Syntax Reference — The Patterns That Actually Matter

Character Classes
  • [abc] — a, b, or c
  • [^abc] — not a, b, or c
  • [a-z] — lowercase letter
  • \d — digit [0-9]
  • \w — word char [A-Za-z0-9_]
  • \s — whitespace
Quantifiers
  • * — 0 or more
  • + — 1 or more
  • ? — 0 or 1
  • {3} — exactly 3
  • {3,} — 3 or more
  • *? — 0 or more (lazy)
Anchors & Groups
  • ^ — start of string/line
  • $ — end of string/line
  • \b — word boundary
  • (abc) — capture group
  • (?:abc) — non-capturing
  • (?=abc) — positive lookahead

Regex Across Engines — Critical Differences

FeatureJavaScriptPythonPCRE (PHP)
Named Groups(?<name>...)(?P<name>...)(?<name>...)
LookbehindFixed-width only (ES2018+)Variable-width supportedVariable-width supported
Unicode \wNo (unless /u flag)Yes (default in Py3)Yes (with /u modifier)

ReDoS — When Your Regex Becomes a Vulnerability

ReDoS (Regular Expression Denial of Service) occurs when a regex engine encounters a pathological input that triggers exponential backtracking.

Vulnerable Pattern: ^(a+)+$

Against the input "aaaaaaaaaaaaaaaaab", this pattern causes many engines to backtrack millions of times, freezing the thread or process.

How to protect: Avoid nested quantifiers. Use atomic groups `(?>...)` if supported. Test against adversarial inputs.

10 Regex Patterns Every Developer Should Know

Email Address (Practical)^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$
URL (Http/Https)^https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&/=]*)$
IPv4 Address^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$
UUID (v4)^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$
ISO 8601 Date^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])$
Strong Password^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]{8,}$

Frequently Asked Questions

What is the difference between regex validator and tester?

Validator checks syntax. Tester checks matches against strings. Our tool does both interactively.

Why does my regex work in Python but not JS?

Differing engine rules. Python supports variable-width lookbehind and `(?P<name>)` groups; JS has fixed-width lookbehind and `(?<name>)` groups.

What does the 'g' flag do?

Global match. Finds ALL matches in the string, not just the first one. Essential for finding multiple occurrences.

What is Catastrophic Backtracking?

When a regex engine takes exponential time to fail a match. Caused by nested quantifiers like `(a+)+`.

What is a non-capturing group `(?:...)`?

Groups part of a pattern (for quantifiers/alternation) without saving the matched text into a numbered capture group.

What does `\b` match?

A word boundary position. It matches the spot between a word char `\w` and a non-word char `\W`. Zero-width.

Can I parse HTML with regex?

No. HTML is not a regular language. Use a DOM parser (BeautifulSoup, DOMParser) instead.

Greedy vs Lazy quantifiers?

`*` is greedy (eats as much as possible). `*?` is lazy (eats as little as possible). `<b>.*</b>` matches whole string; `<b>.*?</b>` matches first tag.

Related Free Developer Tools

Write It Once. Test It Thoroughly.

Paste your pattern above, throw every edge case at it, and know exactly what it matches — and what it doesn't.