Skip to content
Toolzent

Regex Tester (Online Regular Expression Tester)

Test JavaScript regular expressions online. Enter a pattern, flags, and a test string to see live matches, positions, and capture groups instantly in your browser.

Updated 2026-06-14 · Free · No sign-up · Runs privately in your browser

Matches found
Status
Match list (text, position, capture groups)
Flag reference

g global (find all), i ignore case, m multiline (^ $ per line).

s dotall (. matches newlines), u unicode, y sticky.

How the Regex Tester Works

This tool compiles your regular expression and runs it against a test string live as you type. It reports how many matches were found, the matched text, the position (index) of each match, and the contents of every capture group. Everything runs in your browser using the JavaScript regex engine, so nothing is sent to a server.

The Formula

There is no arithmetic here; the engine builds and applies a pattern:

Compile: new RegExp(pattern, flags) Apply: scan the test string, returning each match, its index, and capture groups $1, $2, …

With the g (global) flag, the tester collects every match with matchAll. Without it, only the first match is returned, matching how JavaScript’s own String.match behaves.

Worked Example

Pattern \b\w+@\w+\.\w+\b with flag g, run against:

Contact us at [email protected] or [email protected] for details.

#MatchIndex
1[email protected]14
2[email protected]36

The pattern finds two email-like substrings. Add a capture group, such as (\w+)@, and the tester will also show $1 = hello and $1 = sales for the two matches.

Understanding Flags

FlagNameEffect
gglobalfind all matches, not just the first
iignore casematch regardless of letter case
mmultiline^ and $ match at line breaks
sdotall. also matches newline characters
uunicodefull Unicode code-point handling
ystickymatch only at the current lastIndex

Tips for Writing Patterns

  • Use \b for word boundaries, \d for digits, \w for word characters, and \s for whitespace.
  • Wrap parts you want to extract in parentheses to create capture groups.
  • Prefer non-greedy quantifiers like *? and +? when you want the shortest possible match.
  • Escape special characters such as ., ?, (, and [ with a backslash when you mean them literally.

Because the evaluation happens locally and updates on every keystroke, the regex tester is ideal for iterating quickly until your pattern matches exactly what you intend before dropping it into your code.

Frequently asked questions

What is a regex tester?+

A regex tester lets you type a regular expression and a sample string and immediately see which parts of the string match, where they occur, and what each capture group captured. It is the fastest way to debug a pattern before pasting it into your code, without running the whole program.

Which regex flavor does this tester use?+

This tool uses the JavaScript (ECMAScript) regular expression engine built into your browser, the same engine used by Node.js and front-end JavaScript. Most syntax is shared with other flavors, but features like lookbehind, named groups, and some escapes follow the JavaScript specification.

What do the regex flags mean?+

Flags change how the pattern is applied: g finds all matches instead of stopping at the first, i ignores case, m makes ^ and $ match line boundaries, s lets the dot match newlines, u enables full Unicode handling, and y anchors matching to the lastIndex (sticky). Combine them like gi or gm.

How do capture groups work?+

Parentheses in a pattern create capture groups. Each group records the substring it matched and is numbered left to right as $1, $2, and so on. This tester lists the captured text for every group of each match, which is useful for extracting parts of a string such as the year, month, and day from a date.

Is my test string sent to a server?+

No. The pattern, flags, and test string are evaluated entirely in your browser using the local JavaScript engine. Nothing you type is uploaded, so you can safely test patterns against private or sensitive sample data.