Developer & data

Regular expression tester

Inspect JavaScript regex matches and positions in a timed background worker.

Runs in your browser · No file or text uploads
Preparing your tool…
ABOUT THIS TOOL

What Regular expression tester helps you do

Check whether a pattern finds the intended parts of a log or document. Slow patterns are stopped rather than left running indefinitely.

How to use it

  1. Enter a pattern without surrounding slashes.
  2. Choose flags and enter a test string.
  3. Run the test and review matches and UTF-16 positions.

Input and output example

INPUT
Pattern: \d+ / Text: Order 123, 45
OUTPUT
123 at index 6 / 45 at index 11

Supported formats and limits

  • Maximum text: 100 KiB of UTF-8; pattern: 2,000 characters; displayed matches: 1,000.
  • A Web Worker stops after 1.5 seconds. Supported syntax depends on the browser’s JavaScript regex engine.

How the result is calculated

Without g, only the first match is shown. Positions are zero-based UTF-16 indexes, so emoji can occupy multiple units. A zero-length match advances the next search position. Supported flags: g i m s u y d.

Frequently asked questions

Why can an index differ from the character counter?

JavaScript indexes count UTF-16 units. Visible graphemes and emoji can use more than one unit.

Can I stop an expensive pattern?

Yes. Use Cancel while it runs. The worker is also terminated automatically after the time limit.