Regex Tester for JavaScript

Live regex matches with groups, flags and replace, run in a worker that stops after 3 seconds.

WebRuns in your browser

About this tool

Test a JavaScript regular expression against sample text and see every match with its position and capture groups. Add a replacement string to preview the result of a replace.

Patterns with nested quantifiers such as (a+)+ can take exponential time on some inputs and freeze the page, so the tester warns about them and asks before running.

How to use it

  1. Type a pattern and its flags, such as g to find every match or i to ignore case.
  2. Paste the text to test it against.
  3. Run the test to list each match with its index and groups. Add a replacement to preview the replaced text.

Example

Input:

Pattern: (\d{4})-(\d{2})-(\d{2})   Flags: g
Text:    Released 2024-03-15, patched 2024-04-02.
Replace: $3/$2/$1

Matches and replaced text:

2024-03-15 at index 9, groups 2024, 03, 15
2024-04-02 at index 29, groups 2024, 04, 02
Released 15/03/2024, patched 02/04/2024.