{
  "name": "regex.test",
  "group": "text",
  "summary": "Test a regular expression against text and inspect every match and capture group.",
  "description": "Runs a JavaScript regular expression and returns each match with its index, numbered groups and named groups — or performs a replace or split. Invalid patterns come back as a readable explanation instead of a thrown error, so a pattern can be corrected without a round trip through a broken deploy.",
  "keywords": [
    "regex",
    "regular expression",
    "regex tester",
    "pattern match",
    "capture group",
    "regex replace"
  ],
  "endpoint": "https://fluentedi.com/v1/regex/test",
  "mcp_name": "regex_test",
  "makes_network_request": false,
  "parameters": {
    "type": "object",
    "properties": {
      "pattern": {
        "description": "Regular expression source, without delimiters.",
        "type": "string",
        "maxLength": 2000,
        "examples": [
          "\\b(\\w+)@(\\w+\\.\\w+)\\b"
        ]
      },
      "text": {
        "description": "Text to run the pattern against.",
        "type": "string",
        "maxLength": 200000
      },
      "flags": {
        "description": "Regex flags, e.g. \"gi\". The g flag is added automatically for match_all, replace and split.",
        "type": "string",
        "default": "g",
        "maxLength": 8
      },
      "operation": {
        "description": "What to do with the pattern.",
        "type": "string",
        "enum": [
          "match_all",
          "test",
          "replace",
          "split"
        ],
        "default": "match_all"
      },
      "replacement": {
        "description": "Replacement string for the replace operation. Supports $1, $<name>.",
        "type": "string",
        "default": ""
      },
      "limit": {
        "description": "Maximum matches to return.",
        "type": "integer",
        "default": 100,
        "minimum": 1,
        "maximum": 1000
      }
    },
    "required": [
      "pattern",
      "text"
    ],
    "additionalProperties": false
  },
  "examples": [
    {
      "description": "Extract emails with capture groups",
      "url": "https://fluentedi.com/v1/regex/test?pattern=(%5B%5Cw.%5D%2B)%40(%5B%5Cw.%5D%2B)&text=ping%20ada%40example.com%20and%20grace%40navy.mil",
      "args": {
        "pattern": "([\\w.]+)@([\\w.]+)",
        "text": "ping ada@example.com and grace@navy.mil"
      }
    },
    {
      "description": "Redact digits",
      "url": "https://fluentedi.com/v1/regex/test?pattern=%5Cd&text=card%204242%204242&operation=replace&replacement=*",
      "args": {
        "pattern": "\\d",
        "text": "card 4242 4242",
        "operation": "replace",
        "replacement": "*"
      }
    }
  ],
  "suggestion": null
}