{
    "slug": "find-and-replace",
    "name": "Find and Replace",
    "url": "https://directory.milunir.com/text-tools/text-formatting/find-and-replace/",
    "description": "Replace words in pasted text by exact match, JavaScript regex with $1 capture groups, a list of old => new pairs, or many terms at once.",
    "inputs": {
        "type": "object",
        "properties": {
            "mode": {
                "type": "string",
                "enum": [
                    "plain",
                    "regex",
                    "bulk"
                ],
                "description": "Mode",
                "default": "plain"
            },
            "text": {
                "type": "string",
                "description": "Your text",
                "default": "The colour of the cat matched the colour of the mat."
            },
            "find": {
                "type": "string",
                "description": "Find. One word or phrase per line; every line gets the same replacement.",
                "default": "colour"
            },
            "pattern": {
                "type": "string",
                "description": "Pattern. A JavaScript regular expression, without the slashes.",
                "default": "(\\w+) of the (\\w+)"
            },
            "pairs": {
                "type": "string",
                "description": "Find => replace, one per line",
                "default": "colour => color\ncat => dog"
            },
            "replace": {
                "type": "string",
                "description": "Replace with",
                "default": "color"
            },
            "match_case": {
                "type": "boolean",
                "description": "Match case",
                "default": false
            },
            "whole_word": {
                "type": "boolean",
                "description": "Whole words only",
                "default": false
            },
            "multiline": {
                "type": "boolean",
                "description": "^ and $ match each line",
                "default": false
            }
        },
        "additionalProperties": false
    },
    "outputs": [
        {
            "key": "primary",
            "label": "Text after replacing"
        },
        {
            "key": "replacements",
            "label": "Replacements"
        },
        {
            "key": "lines_changed",
            "label": "Lines changed"
        },
        {
            "key": "characters_after",
            "label": "Characters after"
        }
    ],
    "modes": [
        {
            "id": "plain",
            "label": "Find text",
            "inputs": [
                "text",
                "find",
                "replace",
                "match_case",
                "whole_word"
            ]
        },
        {
            "id": "regex",
            "label": "Regex",
            "inputs": [
                "text",
                "pattern",
                "replace",
                "match_case",
                "multiline"
            ]
        },
        {
            "id": "bulk",
            "label": "Pair list",
            "inputs": [
                "text",
                "pairs",
                "match_case",
                "whole_word"
            ]
        }
    ],
    "feed": null,
    "endpoint": "https://api.tools-directory.workers.dev/v1/tools/find-and-replace",
    "mcp_tool": "find_and_replace",
    "example": {
        "inputs": {
            "mode": "plain",
            "text": "The cat sat on the cat mat.",
            "find": "cat",
            "replace": "dog"
        },
        "output": "Text after replacing: The dog sat on the dog mat.\nReplacements: 2\nLines changed: 1"
    }
}