Free & Private Online Browser Utility

Online Regex Tester with Live Match Groups

This tool tests regular expressions using the JavaScript RegExp engine built into your browser. It does not emulate PCRE, Python re, Ruby Regexp, or any other flavor. The engine supports the standard JavaScript flag set: g (global, find all matches), i (case-insensitive), m (multiline, anchors match line boundaries), and s (dotAll, dot matches newline). Matches are found by calling regex.exec in a loop when the global flag is set, or by a single exec call when it is not. Each match is highlighted in the test string panel. Named capture groups and lookahead/lookbehind assertions are supported in the JavaScript engine starting with ECMAScript 2018. Backreferences and possessive quantifiers work as defined in the ECMA-262 specification. The tool also includes a replace mode that calls testString.replace(regex, replaceWith), letting you preview substitution output before using it in code. Eight preset patterns are included for common tasks: email addresses, URLs, IPv4 addresses, hex color codes, ISO dates, US phone numbers, UUID v4, and hex RGB colors.

How to use

  1. Step 1: Enter a Pattern and Set Flags

    Type your regular expression into the pattern field without surrounding slashes. Toggle the flags g, i, m, and s with the flag buttons. The pattern is applied to the test string on every keystroke.

  2. Step 2: Review Match Highlights and Groups

    Matching substrings are highlighted in the test string panel. Below the panel, each match is listed with its start index and any captured groups.

  3. Step 3: Optional: Test Replace

    Enable Replace Mode and enter a replacement string or capture group reference such as $1. The substituted result is shown in a preview panel below.

Options explained

Flags (g, i, m, s)

g finds all occurrences. i makes the match case-insensitive. m makes ^ and $ match at line boundaries. s makes . match newline characters.

When to use: Enable g for most use cases. Add m when testing patterns that should match at the start or end of each line in a multi-line string.

Preset Patterns

Eight built-in presets load a pattern, flags, and a sample test string. Presets cover email, URL, IPv4, hex color, ISO date, US phone, UUID v4, and hex RGB.

When to use: Use presets as a starting point to understand the pattern syntax and then modify them for your specific requirements.

Replace Mode

Activates a replacement string field and shows the result of testString.replace(regex, replaceWith) in a preview output.

When to use: Use to confirm that a substitution pattern produces the expected output before copying the regex into your code.

Worked example

Input: Pattern: [a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,} | Flags: gi | Test string: Contact info@example.com or support@toolverve.com

Output: Match 1: info@example.com at index 8 Match 2: support@toolverve.com at index 28 Total matches: 2

The email pattern matches two addresses in the test string. Both are highlighted in the test panel.

Tips & limits

  • The JavaScript RegExp engine is not PCRE. Patterns that work in PHP, Python, or Perl may need adjustments. In particular, Python verbose mode comments and PCRE atomic groups are not supported.
  • If the g flag is set and the pattern matches an empty string, the exec loop could run indefinitely. The tool has a safety limit of 500 iterations.
  • Named capture groups use the syntax (?<name>...) and are accessible as match.groups.name in JavaScript code.

Common problems

The pattern shows a syntax error but looks correct

JavaScript RegExp does not support all PCRE syntax. Atomic groups (?>...), possessive quantifiers (++), and branch reset groups (?|...) are PCRE-specific and will cause a SyntaxError in JavaScript.

Matches stop after the first result even with the g flag

If the pattern can match an empty string, exec may stall. The tool caps iterations at 500. Review the pattern to ensure it always advances the position when matched.

Frequently Asked Questions (FAQ)

Which regular expression engine does this tool use?

The tool uses the JavaScript RegExp engine defined by the ECMA-262 specification. It is the same engine used in Node.js and all modern browsers. It does not support PCRE, Python re, Ruby Regexp, or any other flavor.

Does the tool support named capture groups?

Yes. Named capture groups using the syntax (?<name>...) are supported in modern JavaScript engines. The captured values are displayed in the match detail panel.

What does the s (dotAll) flag do?

By default, the dot metacharacter matches any character except newline. With the s flag, dot also matches newline characters, which is useful for patterns that span multiple lines.

Can I use this tool to test patterns for production code?

Yes, as long as your production code runs in a JavaScript environment. The RegExp behavior here matches Node.js and browser JavaScript exactly. If your production code is PHP, Python, Java, or another language, test in that engine as well because syntax support differs.

Files never leave your device; calculations and transformations happen locally.

Last reviewed: 2026-10-18 · Build: deb3bc0