Matches
Capture Groups
Use this tool from AI agents
This tool's engine is available to AI agents over MCP as test_regex. Add the Clean.tools server, then your agent can call it directly.
claude mcp add --transport http clean-tools https://mcp.clean.tools/mcpclaude mcp add --transport http clean-tools https://mcp.clean.tools/mcp{"mcpServers":{"clean-tools":{"command":"npx","args":["-y","@clean-tools/mcp"]}}}{"mcpServers":{"clean-tools":{"command":"npx","args":["-y","@clean-tools/mcp"]}}}https://mcp.clean.tools/mcphttps://mcp.clean.tools/mcpOr call it over plain HTTP from any script. Same engine, JSON in and JSON out, no key:
curl -s https://api.clean.tools/v1/test_regex \
-H 'content-type: application/json' \
-d '{"pattern":"(\\w+)@(\\w+)\\.(\\w+)","text":"hello@clean.tools and support@example.com","flags":"g"}'curl -s https://api.clean.tools/v1/test_regex \
-H 'content-type: application/json' \
-d '{"pattern":"(\\w+)@(\\w+)\\.(\\w+)","text":"hello@clean.tools and support@example.com","flags":"g"}'const res = await fetch('https://api.clean.tools/v1/test_regex', {
method: 'POST',
headers: { 'content-type': 'application/json' },
body: JSON.stringify({ pattern: '(\\w+)@(\\w+)\\.(\\w+)', text: 'hello@clean.tools and support@example.com', flags: 'g' })
});
const data = await res.json();const res = await fetch('https://api.clean.tools/v1/test_regex', {
method: 'POST',
headers: { 'content-type': 'application/json' },
body: JSON.stringify({ pattern: '(\\w+)@(\\w+)\\.(\\w+)', text: 'hello@clean.tools and support@example.com', flags: 'g' })
});
const data = await res.json();How it works
This regex tester uses the browser's native RegExp constructor to compile and execute your pattern against the test string. Matches are highlighted in real time as you type. The tool supports global, case-insensitive, multiline, dotAll, unicode (u), and unicode sets (v) flags, and displays both numbered and named capture groups for each match. The unicode flag lets you use property escapes like \p{L}.
Matching runs in a background Web Worker with a two second time limit, so a pattern that triggers catastrophic backtracking stops instead of freezing the page. Everything runs locally in your browser. Your patterns and test data are never sent to a server. It works on any modern browser, on both mobile and desktop. If you want the same matching from scripts or an AI agent, the identical test_regex engine is available through the Clean.tools API and as an MCP server you can install with the @clean-tools/mcp package from npm.
Frequently asked questions
Which regex syntax does this use?
Patterns compile with the browser's native JavaScript RegExp engine (ECMAScript), so features like lookbehind, named groups (?<name>...), and \p{...} property escapes follow those rules. Syntax from other flavors, such as Perl's \Q...\E or possessive quantifiers, is not supported.
Why do the u and v flags refuse to turn on together?
The unicode (u) and unicode sets (v) flags are mutually exclusive in JavaScript, so enabling one clears the other. Use v when you need set operations and string properties like [\p{Emoji}--\p{ASCII}], and u for plain unicode-aware matching.
Why did my match list stop early or time out?
Results are capped at 10,000 matches to keep the page responsive, and any single evaluation is stopped after two seconds. A timeout usually means the pattern is backtracking heavily, often from nested quantifiers like (a+)+, so anchor or simplify it.
What happens to my pattern and test text?
Both stay on your device. They are matched locally in a Web Worker and, if you use Copy link, they are stored only inside the URL you copy, never sent to a server.
Can I use this from the command line or an AI agent?
Yes. The same regex engine is exposed as a REST endpoint at https://api.clean.tools/v1/test_regex, so you can POST a pattern and test string with curl or fetch and get the matches back as JSON. It is also an MCP server you can add to Claude, Claude Code, or Cursor, which lets an agent run the matcher directly instead of guessing at matches. The @clean-tools/mcp npm package runs that same server locally over stdio if you would rather not use the hosted endpoint.
More tools from Clean.tools
Use Clean.tools from your AI agent
This tool is also test_regex on the Clean.tools MCP server — the same engine, callable by your AI agent directly. No key, no signup: requests are processed in memory and request contents are never stored.
claude mcp add --scope user --transport http clean-tools https://mcp.clean.tools/mcpclaude mcp add --scope user --transport http clean-tools https://mcp.clean.tools/mcphttps://mcp.clean.tools/mcphttps://mcp.clean.tools/mcpEvery tool, the REST API, and setup for Cursor, Claude Desktop, VS Code & more →