Regular Expression Tester

Quick Examples

Call me at 123-456-7890 or 987-654-3210

Test and debug regular expressions with real-time matching and capture group visualization.

API Access

Use this tool programmatically via our REST API. Perfect for validating user input, parsing text data, and automated testing.

Endpoint

POST https://toolteeno.com/api/regex-tester

Request Body

{
  "pattern": "string",  // Required: Regex pattern
  "text": "string",     // Required: Text to test
  "flags": "string"     // Optional: Flags (g, i, m, s, u, y)
}

Example Response

{
  "success": true,
  "matches": [
    {
      "match": "123-456-7890",
      "index": 12,
      "groups": [],
      "input": "Call me at 123-456-7890"
    }
  ],
  "analysis": {
    "totalMatches": 1,
    "isMatch": true,
    "pattern": "\\d{3}-\\d{3}-\\d{4}",
    "flags": "g",
    "textLength": 24
  }
}

cURL Example

curl -X POST https://toolteeno.com/api/regex-tester \
  -H "Content-Type: application/json" \
  -d '{
    "pattern": "\\d{3}-\\d{3}-\\d{4}",
    "text": "Call me at 123-456-7890",
    "flags": "g"
  }'

JavaScript/Fetch Example

const response = await fetch('https://toolteeno.com/api/regex-tester', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    pattern: '\\d{3}-\\d{3}-\\d{4}',
    text: 'Call me at 123-456-7890 or 987-654-3210',
    flags: 'g'
  })
});

const data = await response.json();
console.log(`Found ${data.analysis.totalMatches} matches`);
data.matches.forEach(match => {
  console.log(`Match: "${match.match}" at index ${match.index}`);
});

Python Example

import requests

response = requests.post(
    'https://toolteeno.com/api/regex-tester',
    json={
        'pattern': r'\d{3}-\d{3}-\d{4}',
        'text': 'Call me at 123-456-7890 or 987-654-3210',
        'flags': 'g'
    }
)

result = response.json()
print(f"Found {result['analysis']['totalMatches']} matches")

for match in result['matches']:
    print(f"Match: '{match['match']}' at index {match['index']}")

Common Use Cases

  • Form Validation: Validate emails, phone numbers, URLs
  • Data Extraction: Parse log files, extract data patterns
  • Text Processing: Find and replace operations
  • Pattern Matching: Search for specific formats in text
  • Testing: Debug regex patterns before deployment
  • Learning: Understand how regex patterns work

This API is completely free to use with no rate limits or authentication required!