AI Tools Free

Regex Tester

Test JavaScript regular expressions in a separate worker and inspect matches, offsets, and capture groups.

Free to useNo sign-upRuns in your browser
Enter your details

Enter the inputs, then select Test regex.

Your result
Enter your details

Result will appear here

How Regex Tester works

The tester creates a JavaScript regular expression from your pattern and flags and searches the supplied text in a bounded worker.

The grid shows UTF-16 offsets, matched text, and capture groups. Results are capped at 1,000 matches, and expensive processing is stopped rather than allowed to run indefinitely.

Use distinct supported flags and a pattern no longer than 1000 characters.

A regular expression connected to highlighted matching segments in a text sample.
Illustration of the Regex Tester workflow.

How to use Regex Tester

Enter a JavaScript regular expression, its flags, and the text to test.

Prepare pattern and test text

Enter the pattern without slash delimiters, set the distinct JavaScript flags, and paste the test text. Include representative matches and nonmatches in a bounded sample before expanding it.

Pattern (without /…
Regex Tester native input panel with the actual Pattern (without / delimiters), Flags, Test text settings used for this example.
Configure Pattern (without / delimiters), Flags, Test text; select Test regex.

Run the JavaScript search

Start the test and read the match total. The output identifies the flags and whether the displayed results reached their cap. Without a global flag the search returns only its first match.

3 matches
Regex Tester actual result panel showing 3 matches.
Submitted result: 3 matches. Flags: g.

Inspect offsets and groups

Read the match grid, including offsets, matched text, and capture groups. Offsets are UTF-16 code units. A timeout or capped result calls for a smaller or more focused sample, not an assumption about unseen matches.

Output details
Regex Tester actual output details region and result note after submitting the pictured settings.
Review the actual Regex Tester output. Read the result note.

When to use Regex Tester

Test small, representative samples before using a pattern in another application.

Test a regex extraction pattern

Paste a few representative records when designing a pattern to extract a code or identifier. Include a record missing that identifier. This helps reveal accidental matches without requiring you to test the entire source file at the outset.

Developer input and configuration represented by document cards.
Prepare the input. Concept illustration.

Inspect capture groups before replacement

Test what a pattern matches before using it in a separate replacement operation. Captured groups can help explain which portions a replacement would reference, but this screen reports matches and does not apply a replacement to the input.

A developer example flowing from input to reviewed output.
Inspect an example. Concept illustration.

Compare JavaScript behavior

Use a compact example to investigate a difference between a browser pattern and another regex engine. Record the pattern and flags with the result. A JavaScript match does not establish that a PCRE or server language pattern behaves identically.

Developer output handed to the next stage of a workflow.
Use the result in your workflow. Concept illustration.

Read match positions and limits

Use match positions and captured groups to see which portions of the sample the JavaScript expression accepts.

Match indexes use JavaScript UTF-16 code unit positions. An emoji before a match can make that index differ from a count of visible characters or Unicode code points.

The results are capped at 1000 matches, and expensive expressions can be stopped by the worker. A truncated result or timeout is not evidence that later text contains no matches.

A developer result reviewed alongside its source.
Review the returned output. Concept illustration.

Check syntax before expanding the sample

Test representative matching and nonmatching text with the flags supported by your browser.

Use distinct supported flags and a pattern no longer than 1000 characters. Browser support still determines whether particular flags or combinations compile. Input text is limited to 50000 characters.

For a timeout, reduce the sample and review nested repetition or broad alternatives. An empty text sample is allowed, which is useful when checking whether a pattern can produce an empty match.

Input format and assumptions reviewed for a developer task.
Check format and assumptions. Concept illustration.

Test a JavaScript regular expression

Enter a JavaScript regular expression, its flags, and the text to test.

Test a pattern

Regex Tester: common questions

Answers about using Regex Tester and understanding its results.

Can I paste /pattern/g?

Enter the pattern without the outer slashes and put g in Flags.

What if the pattern matches an empty string?

The tester advances safely after each zero-length match so it does not loop forever.

Does it use the same syntax as Python or PCRE?

No. It uses the browser JavaScript RegExp engine. Check features and flags against the environment where your pattern will run.

Why do I see only one match?

Without the g flag the tester reports the first match. Add g when you want a global search.