Regex Tester

Run a JavaScript regular expression against pasted text and inspect matches, indexes, groups, and syntax errors without sending the pattern or sample away from the browser.

Browser-localFreeNo upload required

Tool workspace

Supported JavaScript flags: g, i, m, s, u, y.

Advanced / Raw output

What this tool is for

Run a JavaScript regular expression against pasted text and inspect matches, indexes, groups, and syntax errors without sending the pattern or sample away from the browser.

How to use

  1. Enter the pattern without slash delimiters and choose only supported JavaScript flags.
  2. Paste representative text, including at least one expected match and one non-match.
  3. Review indexes and captured groups before moving the expression into production code.

Example

Test `^INV-\d{4}$` with the multiline flag against invoice IDs and confirm that malformed IDs do not match.

FAQ

Which regex flavor is used?

JavaScript RegExp in the current browser.

Can a regex freeze the page?

Pathological backtracking patterns can be expensive; keep test input small and review complex expressions carefully.

Reproducible examples

Known inputs and expected results

Run these examples in the workspace above and compare the result with the documented output.

Invoice identifier validation

Input
INV-2026 INV-26
Options
Pattern ^INV-\d{4}$ with flags gm.
Action
Run the JavaScript RegExp.
Expected output
One match: INV-2026 at its reported index.
Explanation
Anchors apply per line with m, and exactly four digits are required.

Capture repeated fields

Input
Ada <ada@example.com>
Options
Pattern ([A-Za-z]+) <([^>]+)> with flag g.
Action
Run and inspect groups.
Expected output
One full match with groups Ada and ada@example.com.
Explanation
Captured groups expose the name and address substrings separately.

Error or unsupported case

Invalid or explosive pattern

Input
Pattern (unclosed against a very long repeated input
Expected error or limit
Invalid syntax is rejected; catastrophic-backtracking risk cannot be proven safe automatically.
Safer alternative
Correct the syntax and test complex patterns with bounded input and a dedicated regex analyzer.

When not to use this tool

  • PCRE-, RE2-, .NET-, or target-engine compatibility guarantees
  • Security proof against denial-of-service backtracking

Algorithm and assumptions

Patterns use the current browser's JavaScript RegExp implementation and flags; global zero-length matches are advanced carefully and input length is bounded.

Input and output

Inputs are a JavaScript pattern, flags, and sample text. Output lists matches and positions or a syntax error.

Supported formats and behavior

  • JavaScript flags g, i, m, s, u, and y
  • Captured groups and match indexes
  • Multiple matches when the global flag is used

Limits

  • No PCRE-only syntax
  • No guarantee against catastrophic backtracking
  • Browser JavaScript version determines feature support

Edge cases and common errors

  • Zero-length global matches require careful handling
  • Lookbehind support depends on the browser
  • Unescaped user input can change pattern meaning

Release testing

Release checks cover valid and invalid patterns, flags, captures, no-match results, global matches, empty input, and result clearing.

Privacy boundary

The input and result stay in this browser session. ZZP Box does not upload or store the values entered in this tool.

Related reviewed tools

Choose the next tool by the operation you need, then review that page's stated input and limits.