x402AgentTools

🔮Regex Tester

Test a regular expression against text and see every match: the matched substring, its index, and all capture groups. Deterministic — the same pattern and text always produce the same result, unlike LLM-simulated regex matching.

Worked examples

Extract emails

GET /api/v1/dev/regex-tester?pattern=%5B%5Cw.%2B-%5D%2B%40%5B%5Cw-%5D%2B%5C.%5B%5Cw.%5D%2B&flags=g&text=Contact%20jane%40acme.io%20or%20bob%40test.org%20today

Result: 2 matches

Capture groups

GET /api/v1/dev/regex-tester?pattern=(%5Cd%7B4%7D)-(%5Cd%7B2%7D)-(%5Cd%7B2%7D)&flags=g&text=Due%202026-01-15%2C%20shipped%202026-02-20

Result: 2 matches

Find hashtags

GET /api/v1/dev/regex-tester?pattern=%23%5Cw%2B&flags=g&text=Loving%20%23base%20and%20%23x402%20today!

Result: 2 matches

Machine API (x402)

$0.002 / call

This tool is also a JSON API for AI agents. Requests without payment receive 402 Payment Required plus instructions; agents pay USDC on Base via the x402 protocol — no accounts, no API keys.

GET /api/v1/dev/regex-tester?pattern=%5B%5Cw.%2B-%5D%2B%40%5B%5Cw-%5D%2B%5C.%5B%5Cw.%5D%2B&flags=g&text=Contact%20jane%40acme.io%20or%20bob%40test.org%20today HTTP/1.1
Host: localhost:3000

→ 402 (payment required, instructions in headers)
→ 200 (after X-PAYMENT header; JSON body below)

{
  "tool": "dev/regex-tester",
  "input": {"pattern":"[\\w.+-]+@[\\w-]+\\.[\\w.]+","flags":"g","text":"Contact jane@acme.io or bob@test.org today"},
  "result": { "value": 2, "answer": "2 matches" }
}

Agent docs: /llms.txt · OpenAPI spec · integration guide

About this tool

Test a regular expression against real text and see every match with its position and capture groups — the fastest way to debug a pattern before shipping it, and a building block for extraction pipelines.

Frequently asked questions

Which regex flavor is used?

JavaScript RegExp (ECMAScript). Most patterns are portable, but lookbehind and named groups use the JS syntax.

Related tools