Regex Tester, Validator & Builder — Test Regex Online
Enter a regex pattern, a flags string, and a test input and the tester compiles the pattern with the native JavaScript RegExp engine, then highlights every match in the input along with each numbered and named capture group. Matching re-runs on every keystroke so you can iterate the pattern until it does exactly what you need.
Reach for this when building a validator for email, URL, SKU, or ID formats; writing a search-and-replace expression before running it across a codebase; debugging a regex that matches too much or too little; extracting fields from log lines or freeform strings; or learning and teaching regex syntax against concrete examples. The output tells you exactly what matched where, which is usually the missing piece when a pattern misbehaves.
All five primary JavaScript flags are supported: g for global, i for case-insensitive, m to make ^ and $ match line boundaries, s (dotAll) to let . match newlines, and u for full Unicode matching. Each match reports its start and end index in the input, plus the values of every capture group — both positional and named (?<name>...) — so you can see the full structure without having to instrument code. Invalid patterns surface the same SyntaxError you would get at runtime, including the position of the offending character.
The pattern and the test input stay in your browser — no server-side execution, no request log.
About this tool
A real-time regex playground for testing and debugging regular expressions. See matches highlighted as you type with support for capture groups and all standard flags.
- Real-time matching as you type
- Capture group display
- All JS regex flags (g, i, m, s, u)
- Match highlighting with positions
100% client-side. Your inputs never leave your browser. Ads via AdSense (consent required).
Frequently asked questions
How do I test a regex online?
Open the JSONCraft regex tester, paste your pattern (without slashes or delimiters) into the pattern field, paste a sample string into the test input, and the tool highlights every match in real time. Toggle flags (g, i, m, s, u, y) with one click and read capture groups in the table below. Nothing is uploaded — the entire match runs in your browser using JavaScript's native RegExp engine, so you can paste production log lines or sensitive samples safely.
How do I test a regex pattern?
Paste your pattern (without delimiters) and a test string; the tester compiles the regex with JavaScript's RegExp engine and highlights every match in the string, listing capture groups and named groups below. Flags g, i, m, s, u and y are toggleable. A replace field lets you preview substitution output live with $1, $<name> backreferences. Syntax errors are reported inline with the offending character position.
Is the regex tester free?
Yes, completely free with no signup or query cap. Test as many patterns as you want — useful for debugging validation rules, scraping patterns or sed-style replacements. JSONCraft has a single open tier; the regex tester is as unrestricted as the formatter and diff.
Does the regex tester upload my pattern or input?
No. Everything runs in your browser using the native RegExp engine. Nothing is transmitted — important because test strings often contain log excerpts, email addresses or other real data you're trying to pattern-match. You can paste production samples without leaking them.
Does it support named capture groups and lookbehind?
Yes. Named groups (?<name>...) are supported and displayed by name in the match table. Lookahead (?=...) and negative lookahead (?!...) have always worked; lookbehind (?<=...) and negative lookbehind (?<!...) work in all modern browsers. Unicode property escapes like \p{Emoji} work when the u flag is set. The engine is whatever ES2022-era JavaScript your browser ships.
How is JavaScript regex different from PCRE or Python re?
Most syntax is shared, but JavaScript lacks some PCRE features: no possessive quantifiers, no recursive patterns, no atomic groups, no \K. Inline modifiers like (?i) are not supported — flags go on the regex literal. Named groups use (?<name>...) syntax (same as .NET), not (?P<name>...) like Python. If you're porting a pattern, watch for these; most simple patterns transfer cleanly.