Regex Tester

Test & debug regular expressions

2 matches
Pattern
/ /gi
Test String 71 chars
Highlighted Matches
Contact us: [email protected] or [email protected]. Invalid: foo@bar
Match Details 2
group 1 hello
group 2 syntaxly.dev
group 1 support
group 2 example.com
Deep dive

Reading a regular expression

A regular expression is a compact pattern for matching text. The engine scans your input left to right, trying to align the pattern against each position — literals match themselves, character classes like \d or [a-z] match sets, and quantifiers like +, *, and {2,4} control how many times.

Two features do most of the heavy lifting. Anchors (^, $, \b) pin a match to a boundary instead of floating anywhere, and capture groups pull pieces out of a match for reuse. Seeing matches highlighted live — with each group broken out — turns regex from guesswork into something you can actually verify.

This runs on the browser's own JavaScript engine, entirely client-side, so your patterns and test data stay local.

Reference

Anchors vs. quantifiers

Anchors & boundaries

Control where a match may start or end — without consuming characters.

^ / $ — line start & end
\b — word boundary
(?=…) — lookahead
Quantifiers

Control how many times the preceding token repeats.

* — zero or more
+ — one or more
{2,4} — a bounded range
In practice

Where developers use it

01

Validating input

Build and test an email or phone pattern against real and malformed samples before wiring it into a form.

02

Extracting data

Use capture groups to pull dates or IDs out of log lines and confirm each group lands correctly.

03

Search & replace

Prototype a find pattern here before running it across a codebase in your editor.

Questions

Frequently asked questions

JavaScript (ECMAScript) regular expressions, via the browser's native engine. Most syntax is shared across languages, but details differ — JS has no \A/\z anchors, uses (?<name>…) for named groups, and only supports lookbehind in modern engines. Patterns here behave exactly as they will in your JS/TS code.

g finds all matches (not just the first); i ignores case; m makes ^/$ match per line; s lets . match newlines; u enables full Unicode; and y anchors matching to lastIndex.

You probably need the global flag. Without g, the engine returns only the first match. Toggle g to scan the whole string — this tester then lists every match with its index and groups.

(…) is a capturing group you reference by number; (?<year>…) is a named group you reference by name, which is far more readable. (?:…) groups without capturing at all. This tester lists every group it finds per match.

Nested quantifiers on overlapping patterns — like (a+)+ — can cause catastrophic backtracking, where the engine explores exponentially many paths. Rewrite to avoid ambiguity (be more specific, use possessive/atomic constructs where available) if a pattern hangs on certain inputs.

No. Matching runs locally with the browser's regex engine; nothing is uploaded.

Related

Pairs well with

© 2026. Syntaxly | Built for the minimalist developer.