inyourbrowser.com

Regex tester

Regex tester is a developer tool that runs JavaScript regular expressions against test input. It lists each match with its position and capture groups, supports the g, i, m, s, u and y flags, and offers match, replace, and split modes. The tool runs in your browser.

//
Test string
0 matches
Enter a pattern and test string above

MODE

Runs entirely in your browser

How to test a regular expression

  1. Type the pattern at the top, without the surrounding / characters.
  2. Toggle flags with the buttons next to it: g (on by default), i, m, s, u and y.
  3. Paste or type up to 5,000 characters in the Test string box.
  4. Pick Match, Replace or Split in the side panel. In Replace mode, type the replacement, using $1, $<name> or $& for captured text.
  5. Read the results as you type: each match with its index and groups, the replaced text, or the numbered split parts.
  6. Click Copy result to copy the output.

Common uses

  • Testing a regex pattern against sample data before using it in production code, use text diff to compare the original and transformed text after a replace operation
  • Building and debugging regular expressions interactively with instant feedback
  • Extracting captured group values to verify that named or numbered groups work correctly. The JSON formatter is useful when the captured output is JSON

Technical specification

  • Algorithm or formula: JavaScript (ECMAScript) RegExp engine, executed inside a dedicated Web Worker with a 2-second wall-clock timeout to abort runaway catastrophic backtracking.
  • Browser API or library: Native RegExp compiled in the worker; one bundled Worker, started with the page and reused between runs, replaced only after the timeout or when new input arrives while a run is still going; the page renders the results as text, never as HTML.
  • Input limits: Test input up to 5,000 characters. Worker timeout 2 seconds.
  • Output: List of matches with their position and numbered and named capture groups, replace output, and split parts.
  • Known limitations: ECMAScript flavor only; PCRE, Python, and .NET features (e.g., conditional patterns, recursion) are not supported. Patterns that exceed the 2-second timeout return an error.

Frequently asked questions

Which regex flavour does this tester use?
JavaScript (ECMAScript) regex. The g, i, m, s, u and y flags are supported, along with named capture groups, lookahead and lookbehind. Some patterns written for PCRE, Python, or .NET have minor syntax differences. All matching runs in your browser using the native RegExp engine.
Is my data sent to a server?
All regex matching happens in your browser using the native RegExp engine. Our servers are not involved at any point.
Can I test regexes with named capture groups?
Yes. Each match in the list shows its named groups by name ($<name>) as well as by number ($1, $2).
Why does my regex behave unexpectedly with the g flag?
In this tester, g decides how many matches you get: with g on (the default) the Match list shows every match and Replace changes every occurrence; with g off you get only the first. Split ignores g. In your own code, surprises usually come from reusing one global RegExp across test() or exec() calls, because it remembers lastIndex between calls; this tester builds a new RegExp on every run.

Related tools

Find & replace
Find and replace text with plain search or regular expressions. Supports case-sensitive and whole-word matching.
SQL formatter
Beautify and format SQL queries. Supports MySQL, PostgreSQL, T-SQL and standard SQL.
Cron expression explainer
Parse any cron schedule into plain English and see the next run times. Fully in-browser.

Reviewed and tested September 30, 2026.