Developer Tools

Regex Tester

Live

Test a JavaScript-compatible regular expression against text and inspect matches, capture groups, indexes, and replacements.

About Regex Tester

Test a JavaScript-compatible regular expression against text and inspect matches, capture groups, indexes, and replacements. Enter regular expression, flags, test text, replacement text in a purpose-built workspace that keeps related controls together and makes units explicit. The pattern and flags create a browser RegExp. Matches are collected with their zero-based indexes and capture groups, with a safety limit to prevent unbounded output. The result panel reports match count, matches and capture groups, replacement preview, pattern status with copy-ready values and supporting context. The tester follows the browser JavaScript regular-expression engine. Syntax and features can differ from PCRE, .NET, Python, Java, RE2, and other engines. Processing stays in your browser and the entered values are not sent to UtilityPages.

Set up Regex Tester

Workspace

Source workbench

Edit the source fields below and inspect the rendered output alongside your work.

Complete the fields to prepare a result.

Enter the pattern without surrounding slash delimiters.

Enter supported JavaScript flags such as g, i, m, s, or u.

Enter the text to search.

Optionally enter replacement text using JavaScript replacement syntax.

Regex Tester results

Enter the values above, then test regular expression to see the result.

Regex Tester method

The pattern and flags create a browser RegExp. Matches are collected with their zero-based indexes and capture groups, with a safety limit to prevent unbounded output.

How it works

The pattern and flags create a browser RegExp. Matches are collected with their zero-based indexes and capture groups, with a safety limit to prevent unbounded output. The tester follows the browser JavaScript regular-expression engine. Syntax and features can differ from PCRE, .NET, Python, Java, RE2, and other engines.

Examples

Regex Tester example

Example input
{
    "pattern": "\\b[A-Z][a-z]+\\b",
    "flags": "g",
    "test_text": "Ada wrote code. Grace reviewed it.",
    "replacement": ""
}
Expected result
{
    "match_count": 2,
    "matches": [
        {
            "match": "Ada",
            "index": 0,
            "groups": []
        },
        {
            "match": "Grace",
            "index": 16,
            "groups": []
        }
    ],
    "replacement_result": "Ada wrote code. Grace reviewed it.",
    "valid": "Valid JavaScript regular expression"
}

Privacy

This tool does not store your inputs or results on UtilityPages.org.

Frequently asked questions

How does the Regex Tester work?

The pattern and flags create a browser RegExp. Matches are collected with their zero-based indexes and capture groups, with a safety limit to prevent unbounded output.

What information should I enter in the Regex Tester?

Enter regular expression, flags, test text, replacement text. Use values from the same scenario and keep measurement units consistent with the labels shown.

What results does the Regex Tester provide?

The result workspace reports match count, matches and capture groups, replacement preview, pattern status. Supporting values are included so the primary result can be checked and interpreted.

How exact is the Regex Tester?

The tester follows the browser JavaScript regular-expression engine. Syntax and features can differ from PCRE, .NET, Python, Java, RE2, and other engines.