Regex Creator

Regex Creator API

Development

Create and test regular expressions with real-time visualization and AI assistance. Perfect for developers, data scientists, and text processing tasks.

Authentication

All API requests require a valid API key passed in the Authorization header as a Bearer token.

Rate Limit

100 requests per minute

Endpoints

1 endpoint available

Overview

The Regex Creator API allows you to test regex patterns against text and get AI-powered assistance for creating, explaining, or debugging regular expressions.

Features

  • Test regex patterns against example text with match details
  • Get all matches with their positions and capture groups
  • AI-powered regex generation from natural language descriptions
  • AI explanations for complex regex patterns

Use Cases

  • Validate regex patterns before deploying to production
  • Generate regex patterns from descriptions via AI
  • Extract pattern matches from text programmatically
  • Debug and understand existing regex patterns

Endpoints

POST
/v1/tools/regex-creator
Test regex patterns or get AI assistance with regex creation

Request Body

Content-Type: application/json

ParameterTypeRequiredDescription
operation
string
Required
Operation to perform: "test" (test pattern against text) or "assist" (get AI help with regex)
regex
string
OptionalThe regex pattern to test (required for "test" operation)
exampleText
string
OptionalText to test the regex against (required for "test" operation)
userRequest
string
OptionalNatural language request for AI assistance (required for "assist" operation). E.g., "Create a regex to match email addresses"

Response Example

{
  "success": true,
  "data": {
    "matches": [
      {
        "match": "test@example.com",
        "index": 15,
        "groups": []
      },
      {
        "match": "hello@world.org",
        "index": 45,
        "groups": []
      }
    ],
    "matchCount": 2,
    "aiExplanation": null
  }
}

Error Codes

400
Bad Request - Invalid regex pattern or missing required parameters
401
Unauthorized - Invalid or missing API key
429
Too Many Requests - Rate limit exceeded
500
Internal Server Error

Code Examples

# Test a regex pattern
curl -X POST https://api.opentools.ca/v1/tools/regex-creator \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "operation": "test",
    "regex": "[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}",
    "exampleText": "Contact us at test@example.com or hello@world.org"
  }'

# Get AI assistance
curl -X POST https://api.opentools.ca/v1/tools/regex-creator \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "operation": "assist",
    "userRequest": "Create a regex to match phone numbers in format (123) 456-7890"
  }'

Ready to get started?

Create an API key to start using the Regex Creator API.