Regex tester | Simplify Your Regex Testing

Test and debug regex with our Regex Tester. Supports JavaScript, Python, and PHP. Features syntax highlighting, real-time feedback, and an intuitive interface.

In your browser Updated 05/2026

/ /
Match Results
Common Patterns
Quick Reference

^: Start of line\n$: End of line\n\b: Word boundary\n\B: Not word boundary

\d: Digit [0-9]\n\w: Word [A-Za-z0-9_]\n\s: Whitespace\n.: Any character except newline

Use this tool from your AI agent

Free JSON API and Model Context Protocol (MCP) server. No signup, no API key, CORS open. Designed for Claude, ChatGPT, Cursor, scripts and frontend apps.

curl -X POST https://mate.tools/api/v1/regex-test.php \
  -H "Content-Type: application/json" \
  -d '{"pattern":"\\d+","text":"abc 123 def 456","operation":"match_all"}'
import urllib.request, json

req = urllib.request.Request(
    "https://mate.tools/api/v1/regex-test.php",
    data=json.dumps({"pattern":"\\d+","text":"abc 123 def 456","operation":"match_all"}).encode(),
    headers={"Content-Type": "application/json"},
)
with urllib.request.urlopen(req) as r:
    print(json.load(r))
const r = await fetch("https://mate.tools/api/v1/regex-test.php", {
    method: "POST",
    headers: { "Content-Type": "application/json" },
    body: JSON.stringify({"pattern":"\\d+","text":"abc 123 def 456","operation":"match_all"}),
});
console.log(await r.json());

Add to claude_desktop_config.json (Claude Desktop), ~/.cursor/mcp.json (Cursor), or any other MCP-compatible client:

{
  "mcpServers": {
    "mate-tools": {
      "command": "npx",
      "args": ["-y", "@mate-tools/mcp-server"]
    }
  }
}
API documentation OpenAPI 3.1 npm 60 req/min · 600 req/hour · 1 MB body cap
Frequently Asked Questions

Regular expressions (regex) are powerful pattern matching tools used to search, validate, and manipulate text. They provide a flexible way to describe complex text patterns using a special syntax.

1. Enter your regex pattern in the top field
2. Select any flags you need (g, i, m, etc.)
3. Enter your test text in the large field
4. Click "Test Regex" to see matches highlighted
5. Use the quick reference and examples for help

• Forgetting to escape special characters
- Not using proper anchors (^ and $)
- Incorrect character class usage
- Overuse of greedy quantifiers
- Not testing edge cases

• Practice with different patterns
- Study the quick reference guide
- Try the common patterns examples
- Test your patterns with various inputs
- Experiment with different flags

• g (global): Find all matches
- i (case-insensitive): Ignore case
- m (multiline): Change ^ and $ behavior
- y (sticky): Match from position
- u (unicode): Unicode support
About Regular Expressions

Regular expressions (regex) are powerful text pattern matching and manipulation tools used in programming, text processing, and data validation.

Common Use Cases:

  • Form validation (emails, phones, passwords)
  • Data extraction and parsing
  • Search and replace operations
  • Text processing and formatting
  • Input validation and sanitization