API Reference
Master Regular Expressions in Real-Time
Integrate RegExLab’s validation engine directly into your CI/CD pipelines, linters, or custom developer tools. All endpoints return structured JSON with deterministic performance metrics and strict SLA guarantees.
Endpoints
POST
/v1/validate
Submits a regex pattern and test string for synchronous validation. Returns match groups, capture indices, and compilation time in microseconds. Accepts JSON payloads up to 64KB. Includes optional flags for UTF-8 mode, case sensitivity, and backtracking limits (default: 10,000 steps).
GET
/v1/analyze/:pattern_id
Retrieves cached complexity metrics for previously compiled patterns. Returns time complexity class (O(n), O(n²)), memory footprint, and potential catastrophic backtracking warnings. Requires the pattern to be registered in your workspace registry.
POST
/v1/batch/evaluate
Processes up to 500 test cases against a single pattern in a single request. Ideal for regression testing and linting workflows. Returns a structured array of pass/fail results with execution latency per case and aggregate throughput statistics.
Authentication
Bearer Token & API Keys
RegExLab requires a valid API key attached to every request via the Authorization header. Keys are scoped to your workspace and enforce rate limits of 1,200 requests per minute for standard tiers and 8,500 for enterprise. You can generate, rotate, or revoke keys through the Developer Console under Settings > Integrations > API Access. Tokens expire after 90 days of inactivity and automatically refresh on successful endpoint calls.
Examples
Quick integration patterns for common workflows. All examples use cURL and return compact JSON responses.
CI/CD Pipeline Validation
Run against commit hooks to catch malformed regex before deployment. The /v1/validate endpoint returns a strict 200 OK on success or 422 Unprocessable Entity with detailed error boundaries.
curl -X POST https://api.regexlab.dev/v1/validate \
-H "Authorization: Bearer rlx_sk_8f3a9c2b1d4e" \
-H "Content-Type: application/json" \
-d '{"pattern": "^(\\d{3})-\\d{4}$", "test": "555-0199", "flags": ["u"]}'
Performance Benchmarking
Compare pattern efficiency across engine versions. Use the /v1/analyze endpoint to track backtracking thresholds and memory allocation for large-scale log parsing rules.
curl -X GET "https://api.regexlab.dev/v1/analyze/pat_9x7m2" \
-H "Authorization: Bearer rlx_sk_8f3a9c2b1d4e"