Skip to main content
SiteIndex
DeveloperReady to use

Regex Tester

Test regular expressions against sample text to validate search and parse logic quickly.

Guide

Interactive workspace

No account required
Regex Tester

JavaScript expressions run in a separate worker with a 1-second execution limit. Maximum 2,000 pattern characters, 500,000 text characters, and 1,000 displayed matches. Indices are UTF-16 offsets. An empty pattern matches zero-width positions.

All matches & named groups

See every match with its position, plus any named capture groups your pattern defines.

Both actions use the same flags. Find all matches adds g for enumeration; y keeps sticky behavior. Unmatched captures are null in copied JSON.

How to use it

  1. Enter a JavaScript pattern without / delimiters and choose flags.
  2. Paste synthetic text and select Test pattern or Find all matches.
  3. Expand the match details to inspect UTF-16 indices, numbered captures, and named groups; simplify timed-out patterns.
What is Regex Tester?

Test regular expressions against sample text to validate search and parse logic quickly.

How it works

Both actions execute JavaScript regexes in a dedicated Web Worker using the same flags. A one-second deadline terminates an unresponsive worker. Test pattern returns a boolean; Find all matches adds global enumeration and records UTF-16 positions, numbered captures, and named groups up to the output limit. Edits cancel prior work and clear results.

Example input and expected output

Input

Pattern: (?<word>cat)\d+
Flags: gi
Text: Cat12 cat3

Expected output

Matches: true
"Cat12" at 0, word: "Cat"
"cat3" at 6, word: "cat"
Common uses
  • Validate a regex before using it in code.
  • Review every match position in a longer text sample.
  • Extract named capture groups to confirm parsing logic.
Limitations
  • Evaluation uses a dedicated worker terminated after one second, including startup; very slow devices may need smaller inputs.
  • Limits are 2,000 pattern characters, 500,000 text characters, and 1,000 displayed matches. Supported syntax follows the browser, not PCRE or a server language.
Frequently asked questions
What flags are supported?
Unique JavaScript flags d, g, i, m, s, u, v, and y are accepted when supported by your browser; u and v cannot be combined. Both actions use the same flags.
What if a pattern takes too long?
Its worker is terminated after one second, including startup. Shorten the sample or simplify nested quantifiers. No unsafe main-thread fallback is used.
How are zero-width matches handled?
JavaScript matchAll advances after empty matches, respecting Unicode code points with u or v. The display is capped at 1,000 matches.
What does null mean in captures?
The group did not participate in that match. This is different from a participating group that matched an empty string.

Related tools