Skip to content
Flavor
ECMAScript
Deadline
500 ms
Runtime
Browser

Extract bounded regular-expression matches with offsets

Enumerate one match or all global matches with offsets and capture data up to a hard result count.

Local processingNo sign-upKillable worker

Input

Add g to enumerate repeated matches; omit it to return only the first.

Local

The g flag controls enumeration; other flags retain normal ECMAScript meaning.

Extracted matches

Submit the example or replace it with your own values. User matching runs only in a disposable browser worker.

What this tool proves

Explicit ECMAScript behavior

Extraction follows the flags you provide. Without g, JavaScript returns one match; with g, the worker advances through repeated matches and includes explicit handling for zero-length results.

Global enumeration has explicit progress and result limits

Extraction follows the flags you provide. Without g, JavaScript returns one match; with g, the worker advances through repeated matches and includes explicit handling for zero-length results.

The engine stops at 10,000 returned matches and marks the report truncated if another match exists. It advances an empty global match by one Unicode code point in u mode or one UTF-16 code unit otherwise, preventing a non-progress loop.

Bounded execution protects the page without hiding risk

Any operation that runs a user pattern is isolated in a disposable Web Worker. Tool Swim terminates that worker after 500 ms, caps patterns at 4 KiB and text at 256 KiB, and never runs user matching on the interface thread.

Pattern, flags, text, replacement, matches, and explanations stay in the current browser tab. The public tool makes no developer API request, stores no preset, and works without an account or telemetry.

Primary references

Questions and answers

Related Regex tools