61trust / 100

Regex Explain

by Aayat AI in Security & trust

x402 APIFailing, checked 2 h ago

Validate and explain a regular expression (JavaScript flavour): is it valid, what each part means in plain English, whether it risks catastrophic backtracking (ReDoS), and what it matches in up to 20 test strings (with groups). POST {pattern, flags, tests}.

POST https://aayatai.com/regex/explain

Last 30 days

All checks passedSome failedAll failedNot checked
Uptime
33.3%
Response time
50 ms typical, 50 ms slowest 5%
Last check
2 h ago: Expected HTTP 402, got 410
Next check
any minute now

How to call it

# See the payment challenge (nothing is charged)
curl -i -X POST "https://aayatai.com/regex/explain" \
  -H "content-type: application/json" \
  -d '{"flags":"","pattern":"^(\\d{3})-(\\d{4})$","tests":["555-1234","5551234"]}'
import { wrapFetchWithPayment } from "@x402/fetch";
import { x402Client } from "@x402/core/client";
import { ExactEvmScheme } from "@x402/evm/exact/client";
import { privateKeyToAccount } from "viem/accounts";

const client = new x402Client().register(
  "eip155:8453",
  new ExactEvmScheme(privateKeyToAccount(process.env.AGENT_KEY)),
);
const pay = wrapFetchWithPayment(fetch, client);

// Not sure it's safe to pay? Preflight it first for $0.005:
// GET https://toolvet.app/api/v1/check?url=https%3A%2F%2Faayatai.com%2Fregex%2Fexplain
const res = await pay("https://aayatai.com/regex/explain", {
  method: "POST",
  headers: { "content-type": "application/json" },
  body: JSON.stringify({"flags":"","pattern":"^(\\d{3})-(\\d{4})$","tests":["555-1234","5551234"]}),
});
console.log(await res.json());

Example input

{
  "flags": "",
  "pattern": "^(\\d{3})-(\\d{4})$",
  "tests": [
    "555-1234",
    "5551234"
  ]
}

Example output

{
  "error": null,
  "flags": "",
  "groups": 2,
  "parts": [
    {
      "meaning": "start of the text (or line with the m flag)",
      "token": "^"
    },
    {
      "meaning": "start of capturing group",
      "token": "("
    },
    {
      "meaning": "a digit (0-9)",
      "token": "\\d"
    },
    {
      "meaning": "repeat the previous item exactly 3 times",
      "token": "{3}"
    }
  ],
  "pattern": "^(\\d{3})-(\\d{4})$",
  "risk": null,
  "tests": [
    {
      "input": "555-1234",
      "matched": true,
      "matches": [
        {
          "groups": [
            "555",
            "1234"
          ],
          "index": 0,
          "match": "555-1234",
          "named": null
        }
      ]
    },
    {
      "input": "5551234",
      "matched": false,
      "matches": []
    }
  ],
  "valid": true
}

Security scan

  • No findings. We scan names, descriptions and tool definitions for hidden instructions and other prompt-injection patterns.

Recent checks

WhenResultHTTPTimePrice
2 h agoExpected HTTP 402, got 41041048 ms-
5 h agoExpected HTTP 402, got 410410257 ms-
10 h agoPassed40250 ms$0.001