Result

Matches in your text

Run a test to show matches.

Offsets use zero-based UTF-16 code units; end offsets are exclusive. Empty matches appear in the JSON output but cannot be highlighted.

JSON

Test regular expressions using your browser’s JavaScript engine

This tool uses JavaScript RegExp in a dedicated worker. It never evaluates pasted JavaScript code. Enter the pattern body only, set its flags separately, and run the test. Matches and captured groups are rendered as literal text, including any HTML-looking input.

How to read the results

  1. For a simple example, enter \d+ with g and test “Order 42 costs 15.” The results are “42” and “15”.
  2. Parentheses capture text. (?<word>\w+) also names a group “word”. The output lists numbered captures and named captures; an unmatched optional capture is null.
  3. Use g to collect matches throughout the text. Without it, the tool returns the first match. Sticky y requires a match at the current position, beginning at index 0.
  4. Use d to include capture ranges when your browser supports it. Indexes count UTF-16 code units, so some visible characters take two positions.

Flags and common mistakes

i ignores case, m changes line-boundary behavior of ^ and $, and s allows a dot to match line terminators. u and v enable different Unicode-aware modes and cannot be combined. A flag or pattern unsupported by your current browser produces an error. Do not wrap the pattern in quotes or double its backslashes as you would inside a JavaScript string.

Timeouts, limits, and privacy

Some patterns can spend a long time backtracking. Each run starts a fresh worker, and the page terminates it after about one second or when you select Cancel. Changing any input cancels an active test and clears previous results. Browser scheduling can delay the timeout notice. There is no fallback that runs your pattern on the page’s main thread.

Results are limited to 1,000 matches or 500,000 code units of captured text. A limit notice means the results are incomplete. This tool is intended for bounded examples, not large files or other regex dialects such as PCRE. It does not fetch URLs or upload your test text. A timeout is a reason to simplify a pattern; it is not a complete performance or security audit.

For global patterns that match an empty string, the tool advances one code unit, or one Unicode code point in u/v mode, before finding another match. This avoids an infinite loop while preserving zero-length match positions.