ToolSprinkle.

Regex tester

Test JavaScript regular expressions, inspect captures, replace text and extract matches. A bounded worker keeps difficult patterns off the page.

Find the pattern. See the match.
PROCESSED ON YOUR DEVICE

Presets change settings only. Your input stays in place; Undo restores previous settings.

Ready when you are.

◎ No uploads. Your input stays here.↗ Free to use. No account needed.⌘ / Ctrl + Enter to run

A worked example

Indices are zero-based JavaScript string positions. This example finds an email-like string; it is not comprehensive email validation.

Input / settings

Text: [email protected]
Pattern: [\w.+-]+@[\w.-]+\.[a-zA-Z]{2,}
Flags: gi

Expected result

1 match: [email protected], starting at index 0
A LITTLE GUIDANCE

How to use Regex tester

Enter the pattern without enclosing /slashes/, set flags separately and paste sample text. Select Test pattern. Review highlighted matches and the JSON result; Copy or Download keeps the JSON, not the highlighting.

Good to know

Uses your browser’s JavaScript RegExp engine, not PCRE or Python. Runs stop after one second and return at most 1,000 matches. A completed test is not a performance or validation guarantee for production.

A few quick answers.

Why does a valid pattern time out?

Some patterns have excessive backtracking. The test runs in a worker and stops after one second. Try fewer nested quantifiers or shorter input; results are capped at 1,000 matches.

Is my input sent to a server?

No. This tool processes your input in your browser. We don't store your text, files or results. Standard website access logs are separate; read our privacy notes.

Can I use it for free?

Yes. No account, subscription or usage credits are required.

How do I keep my result?

Use Copy or Download after running the tool. Inputs are not saved automatically and disappear when you leave or refresh the page.

Patterns, flags and match boundaries

Find several matches or just the first

Use pattern \bcat\b with text Cat cat scatter. Flags gi return Cat at index 0 and cat at index 4; i alone returns only Cat. g searches repeatedly, i ignores case, m makes ^ and $ match line boundaries, and s lets a dot match a newline. Enter flags without slash delimiters. Duplicate flags and unsupported combinations such as uv are rejected; newer features depend on your browser.

Extract labeled values with capture groups

For text order=42; order=107, use order=(?<id>\d+) with flag g. The two full matches start at indices 0 and 10. Their groups arrays contain 42 and 107, and namedGroups maps id to each captured string. An unmatched optional capture becomes null in the JSON groups array; unmatched named captures are omitted from namedGroups.

Read line and Unicode examples correctly

To find a whole status line, use ^OK$ with flags gm and text OK, FAIL and OK on separate lines: two matches at indices 0 and 8 when line breaks are single LF characters. For text 😀a, pattern a returns index 2, not 1: offsets count UTF-16 code units. With pattern . and flag gu, the emoji is one match; without u it can be split into surrogate halves. The d flag does not add capture-offset arrays to this tool’s exported JSON.

Keep tests bounded and handle empty matches

A zero-width match is displayed as ∅ and advances before the next global search, so an empty pattern can match between characters. Results stop at 1,000; limited=true means more than 1,000 matches were found. If a pattern times out, reduce the input or remove overlapping/nested quantifiers and rerun. The built-in email-like example is an extraction demo, not comprehensive email-address validation.

Replace or extract matches

Choose Replace matches to use JavaScript replacement tokens: $1 for capture 1, $<name> for a named capture, $& for the whole match and $$ for a dollar sign. Extract matches returns full matches separated by line breaks and downloads as TXT. Both honor flags: use g for all matches. Extraction refuses more than 1,000 matches rather than silently exporting a partial list. Replacement output is limited to 4 million characters; all operations retain the one-second worker timeout.

Check expected matches and export captures

Open Test cases and write one case per line: + followed by a space for text that should match, or - followed by a space for text that should not. Matching anywhere counts. Each case starts with a fresh regex; up to 30 cases and 10,000 characters are supported. Export capture groups produces a JSON array with each full match, index, numbered groups and named groups. Like full-match extraction, it refuses to export more than 1,000 matches.

After extracting a list, remove duplicate lines or sort it. Match mode exports JSON; Extract mode exports the matched values as text, ready for list tools. Use JSON formatter to inspect the full export.

Method reference: MDN JavaScript regular expressions and flags.

Keep your flow going.

More developer tools ↗

What would you like to do?

↑ ↓ Navigate · Enter Open · Esc Close. Switching tools clears unsaved input.