Dev Utilities / Tool 40 / FREE TO USE

Regex Tester

Test JavaScript regular expressions with visible matches, UTF-16 positions and capture groups. A dedicated worker deadline stops runaway backtracking.

THE WORKBENCH

Find the match and understand it.

IN YOUR BROWSER / PRIVATE INPUT
YOUR PRIVATE WORKSPACE

Find the match. Understand why.

Your input is processed in your browser. Nothing is sent to a conversion API.

A dedicated worker is terminated after one second of execution. Maximum 100,000 test characters and 200 matches; global matching is added to collect results.

01 / FROM INPUT TO ACTION

How to use the
Regex Tester

  1. 01

    Enter a pattern and flags

    Use the pattern without surrounding slash delimiters. Select JavaScript flags such as g, i, m, s or u as needed by your browser engine.

  2. 02

    Add representative text

    Include successful examples, near misses, empty values and line breaks. Test input is limited to 100,000 characters.

  3. 03

    Inspect matches and captures

    Review highlighted text, indices and capture groups. Simplify a pattern that exceeds the worker’s one-second execution deadline.

The browser JavaScript engine defines the behavior

The tool constructs a real RegExp in a disposable worker. A global flag is added when necessary to collect results, while the other supplied flags remain in effect. Invalid syntax or duplicate flags produce the engine’s actual error.

This is not a universal PCRE, Python or Java regex emulator. Supported features and Unicode behavior follow your browser. Match indices use JavaScript UTF-16 code-unit positions, which can differ from visible character counts when supplementary characters or combining sequences are present.

Separate the whole match from a capture group

Use a small representative sample while designing a pattern, then add difficult near misses. A pattern that finds one successful example can still behave badly on a long input that almost matches.

THE STARTING POINT
Pattern: (\d+)
Flags: g
Text: Outgle 42 and 8
THE RESULT / NEXT STEP
Match 1: 42, capture 1: 42
Match 2: 8, capture 1: 8
Parentheses create capture groups; the whole match and its location are reported separately.

A worker prevents catastrophic backtracking from freezing the page

Nested or overlapping quantifiers can cause some patterns to try an enormous number of paths. The main page starts an execution deadline after the worker has loaded; if matching exceeds one second, the worker is terminated and an actionable error is shown.

The result display is capped at 200 matches. Empty matches advance explicitly to avoid an endless collection loop. Highlighting shows a bounded text preview, while the JSON export contains the collected match data. A timeout is a signal to simplify or bound the expression, not proof that the intended language is impossible to recognize.

Build patterns that survive real input

01

Test failures as well as successes

Include long near matches and unexpected punctuation, not only the easiest positive example.

02

Choose anchors deliberately

^ and $ interact with the multiline flag. A search for part of a string is different from whole-value validation.

03

Escape data before inserting it into a pattern

User-provided literal text is not automatically regex syntax. This tester does not turn an unsafe application pattern into a safe validator.

THE QUESTIONS THAT COME NEXT

Regex Tester:
questions, answered.

Why are regex match positions different from visible character counts?

JavaScript indices count UTF-16 code units. Some Unicode characters use two units, and a visible grapheme can contain multiple code points.

Why did my regex test time out?

The worker exceeded one second of execution, often due to expensive backtracking. Simplify overlapping quantifiers, add useful bounds or shorten the test input.

Can this tester use PCRE-specific syntax?

It uses the browser’s JavaScript RegExp engine. Syntax from another engine may be unsupported or behave differently.

How does the tester handle an empty regex match?

It advances the search position explicitly, respecting Unicode mode where relevant, so collecting zero-length matches does not loop forever.

FURTHER READING

The calculations and checks above describe this tool's implementation. Use these primary references for the underlying formats and publishing guidance.

JavaScript RegExp reference ↗ (opens in a new tab)
A USEFUL NEXT STEP

Keep the
work moving.

34

Text Diff Checker

Compare expected and actual text when developing extraction rules.

↗
01

Schema Markup Generator

Create clean JSON-LD for your organization, article, product or FAQ.

↗
02

Robots.txt Generator

Define crawler access with a downloadable robots.txt.

↗
YOUR NEXT MOVE

Find the match and understand it.

Use the controls above, inspect the actual result and keep the source until you are ready to use your new copy.

Use the Regex Tester↑
Explore all 41 free tools ↗