← All tool references

Developer Tools · not_available

Regex Tester

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

Open public tool

Overview

Category
Developer Tools
API mode
not_available
Processing
client-side
Privacy
no-data-stored

Public descriptor

The descriptor is available without an API key and supplies this tool’s metadata, schemas, modes, and examples.

GET /api/v1/tools/regex-tester

View this descriptor as JSON

Execute availability

This tool is documented as a browser capability. Its execute route does not produce a server-side result; when execution is enabled, it responds with browser_interaction_required and points callers to the public tool page.

POST /api/v1/tools/regex-tester/execute

Authentication is not issued during the preview. A bearer API key is planned for execution after launch.

Input schema

object object; additional properties are not accepted.

pattern · string · required
Enter the pattern without surrounding slash delimiters.
flags · string · required
Enter supported JavaScript flags such as g, i, m, s, or u.
test_text · string · required
Enter the text to search.
replacement · string · optional
Optionally enter replacement text using JavaScript replacement syntax.
{
    "type": "object",
    "properties": {
        "pattern": {
            "type": "string",
            "description": "Enter the pattern without surrounding slash delimiters."
        },
        "flags": {
            "type": "string",
            "description": "Enter supported JavaScript flags such as g, i, m, s, or u."
        },
        "test_text": {
            "type": "string",
            "description": "Enter the text to search."
        },
        "replacement": {
            "type": "string",
            "description": "Optionally enter replacement text using JavaScript replacement syntax."
        }
    },
    "required": [
        "pattern",
        "flags",
        "test_text"
    ],
    "additionalProperties": false
}

Output schema

On a successful execution, schema values appear in data.result.values.

match_count · number
Match count produced by the calculation.
matches · array
Matches and capture groups produced by the calculation.
replacement_result · string
Replacement preview produced by the calculation.
valid · string
Pattern status produced by the calculation.
{
    "type": "object",
    "properties": {
        "match_count": {
            "type": "number",
            "description": "Match count produced by the calculation."
        },
        "matches": {
            "type": "array",
            "description": "Matches and capture groups produced by the calculation."
        },
        "replacement_result": {
            "type": "string",
            "description": "Replacement preview produced by the calculation."
        },
        "valid": {
            "type": "string",
            "description": "Pattern status produced by the calculation."
        }
    },
    "additionalProperties": false
}

Regex Tester example

The request body follows the published input schema. The response below shows the success-envelope shape returned after execution is available.

curl -X POST "https://utilitypages.org/api/v1/tools/regex-tester/execute" \
  -H "Content-Type: application/json" \
  -d '{
    "pattern": "\\b[A-Z][a-z]+\\b",
    "flags": "g",
    "test_text": "Ada wrote code. Grace reviewed it.",
    "replacement": ""
}'
{
    "ok": true,
    "data": {
        "slug": "regex-tester",
        "result": {
            "values": {
                "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"
            },
            "display": {
                "display": "2"
            },
            "warnings": [],
            "assumptions": [],
            "steps": []
        }
    },
    "meta": [],
    "request_id": "req_example_123"
}

Errors

api_not_launched · 503
Returned by the current launch gate for every execute request.
invalid_json · 400
Returned when an enabled execute request does not contain valid JSON.
validation_failed · 422
Returned when a request does not satisfy the input schema.
browser_interaction_required · 422
Returned for browser capability tools instead of inventing a server-side result.
tool_not_found · 404
Returned when a requested descriptor slug does not exist.
execution_failed · 503
Returned when an enabled server-side execution cannot complete.