ShadTools

Regex Tester

Test JavaScript regular expressions against sample text and inspect captures and named groups.

Test text

Matches

2
Match 1Index 627
https://shadtools.com

Capture groups

$1
https
$2
shadtools.com

Named groups

protocol
https
host
shadtools.com
Match 2Index 3758
http://localhost:4321

Capture groups

$1
http
$2
localhost:4321

Named groups

protocol
http
host
localhost:4321
2matches
58characters tested
giflags

Patterns run with the browser's JavaScript regular expression engine. Avoid untrusted patterns that can cause excessive backtracking.

How to test a regular expression

Enter the pattern without surrounding slash delimiters, add JavaScript flags such as g, i, or m, and paste representative input. The match panel reports the full match, its zero-based index, numbered capture groups, and named groups.

JavaScript regex flags

  • g finds every match instead of stopping after the first.
  • i performs case-insensitive matching.
  • m changes ^ and $ to work at line boundaries.
  • s allows dot to match newline characters.
  • u enables Unicode-aware pattern behavior.
  • y requires the next match to begin exactly at the current index.

Use small, representative examples while developing a pattern, then test edge cases and non-matching input before using it in production.

Frequently Asked Questions

Which regex flavor does this tester use?+

It uses the JavaScript RegExp engine built into your browser, including supported flags and named capture groups. Behavior can differ from PCRE, Python, Java, or .NET regex engines.

What does the g flag do?+

The global flag asks the engine to continue after the first match. Without g or the sticky y flag, the tester reports only the first match.

Can a regular expression freeze the browser?+

Some patterns can trigger catastrophic backtracking on certain inputs. The tool limits pattern and input size, but JavaScript cannot safely interrupt every expensive synchronous regex, so only run patterns you trust.

Related Tools