Regex Tester

Test a JavaScript regular expression against any text and inspect match and capture details. A regular expression tester that runs in your browser.

Work in your browser

Local and private
Flags

How to use Regex Tester

Three simple steps, with your content kept on your device.

01

Enter a pattern

Add JavaScript regular expression source without slash delimiters.

02

Choose flags

Enable global, case, multiline, dot-all, or Unicode behavior.

03

Inspect matches

Review bounded matches and capture groups returned by the worker.

Built for useful work

Fast, focused, and made to be clear on every screen.

Detailed matches

Reports match indexes, captured groups, and named groups as plain text.

Execution timeout

Terminates patterns that run longer than the configured worker limit.

Local testing

Patterns and test text remain in the current browser tab.

What is a regex tester?

A regex tester lets you write a regular expression, apply it to sample text, and see every match with its capture groups. It is the fastest way to build and debug patterns before they go into code.

Instead of running your code repeatedly to test a pattern, you refine it here against live text and copy the working version when it behaves correctly.

JavaScript regular expressions

This tool uses the current browser's JavaScript RegExp engine, so the syntax and behavior match what your code will see at runtime. Flags such as global, case-insensitive, and multiline are toggled with checkboxes.

The supported feature set follows the browser's implemented JavaScript — anything you validate here will behave identically in a JavaScript environment.

Testing a pattern step by step

Enter the pattern source without slashes, choose the flags you need, and paste the text to search. The tool highlights matches and shows the capture groups for each one, so you can see exactly what the pattern extracts.

Working through one case at a time is the practical way to develop regex: start simple, add constraints, and confirm each change against the sample text.

Common regex building blocks

Useful building blocks include character classes, quantifiers, anchors, and groups. Anchors pin a match to a position, groups capture parts of the match, and quantifiers control repetition.

Most patterns you need day to day combine a handful of these elements. Testing them here against realistic input shows whether the combination behaves as intended.

Worker timeout and performance

Some regular expressions can take excessive time on particular input. This tool runs patterns in a web worker and terminates a pattern that exceeds the timeout, so the page never freezes.

A pattern that times out is almost always a sign of catastrophic backtracking — restructuring it usually makes it fast and predictable.

Regex in everyday development

Regular expressions validate inputs, parse logs, extract data, and transform text. A tester that shows matches instantly is the standard companion for writing and verifying these patterns.

Because everything runs in the browser, you can test patterns against private data without sending the text anywhere.

Capture groups and replacements

Capture groups let a pattern extract parts of a match — the username from an email address, the digits from a version string, or the pieces of a date. This tool shows each group's value for every match.

Seeing the captured values as you test makes it obvious whether your groups line up the way the rest of the code expects.

Validating input with regex

Regular expressions are a standard way to validate email addresses, phone numbers, identifiers, and slugs. Testing a pattern against good and bad examples confirms it accepts what it should and rejects what it should not.

A handful of realistic samples — plus one deliberately wrong input — tells you more about a pattern than a long list of theoretical cases.

Debugging complex patterns

Long patterns fail in subtle ways: a group out of place, an unescaped metacharacter, or a quantifier that matches more than intended. Testing incrementally against visible input makes each mistake obvious.

Building the pattern piece by piece here, confirming each part against the sample text, is the most reliable way to arrive at a correct expression.

Testing flags and options

Flags change how a pattern behaves: global finds every match instead of the first, case-insensitive broadens the character set, and multiline changes how anchors treat line boundaries. Testing each combination shows the effect immediately.

Confirming the flags against the actual text prevents the classic mistake of shipping a pattern that matches only the first occurrence.

Frequently asked questions

Should I include slash delimiters?

No. Enter only the pattern source, then choose flags with the checkboxes.

Why can a pattern time out?

Some regular expressions can take excessive time on particular text. The worker is terminated instead of leaving the page unresponsive.

Which regex syntax is supported?

The tool uses the current browser's JavaScript RegExp engine, so support follows that browser's implemented JavaScript features.