Regex Validator
text.validate_regex
Overview
You send a pattern; we compile it on the RE2/J engine and tell you whether it is valid, with the parser's own message when it is not. Send sample strings too and we report which ones the pattern finds a match in. We also flag nested quantifiers, which are harmless here but can hang engines that backtrack. Nothing is stored and no text is transformed — this is a check, not an extraction.
Before you deploy a regex, we validate syntax and test samples in a safe linear-time engine so broken patterns fail early.
Reliability
STRICT and deterministic — identical pattern, flags, and samples always yield identical results. RE2/J guarantees linear-time execution with no catastrophic backtracking. A pattern that will not compile is a normal success response with valid: false, not an error, so branch on that field. Input validation (not retryable): pattern missing or not a string; pattern longer than 10,000 characters; samples that is not an array of strings.
Context footprint
No file I/O. Accepts inline pattern and samples only. Provides instant safety verification without LLM regex reasoning. A successful call costs 1 execution credit.
When to use it
When an agent or user submits a regex and you need syntax validation plus sample match verification before production use.
Do not use for high-volume extraction (use text.extract_entities_regex) or PCRE-only features like lookahead and backreferences.
Powered by RE2/J, Google's linear-time regular-expression engine that is immune to catastrophic backtracking.
Scope
Non-goals
- Does not execute regex on production data at scale
- Does not support PCRE-only features (lookahead, backreferences)
- Does not replace or transform text — validation and testing only
Properties
Capabilities
Cost & billing
Flat rate per invocation
File handling
How we handle your data
What this means
This skill may receive sensitive content, but it does not target sensitive data and returns only a structured non-sensitive result.
Squillify guarantees
- Runs inside Squillify using a self-contained open-source component
- This skill runs inside Squillify.
- Payloads are not sent to an external service by this skill.
- Self contained open source component
- Squillify does not permanently store submitted payloads.
- Telemetry records metadata only, not submitted content.
- Submitted payloads are not used for training.
- Submitted payloads are not reviewed by humans.
- This skill does not target sensitive data.
- The response does not contain submitted content.
Your responsibility
Squillify does not determine whether submitted content is sensitive. Your application is responsible for deciding what data it is allowed to submit. Your application is responsible for securing the response.
Input schema
| Field | Type | Required | Description |
|---|---|---|---|
| pattern | string | Yes | RE2/J regular expression to validate. |
| flags | string | No | Optional RE2/J flag string; omit it for no flags. |
| samples | array | No | Bounded optional array of sample strings; omit it to perform syntax validation only. The item shape is defined by the nested schema and the array contains from 0 through 1000 items. |
| engine | string | No | Regex engine; omit it for re2j. |
Output schema
| Field | Type | Required | Description |
|---|---|---|---|
| valid | boolean | Yes | Whether the regular expression compiled successfully. |
| engine | string | Yes | Applied regular-expression engine. |
| syntaxError | string | No | Safe syntax error when compilation failed. |
| warnings | array | Yes | Bounded warning array containing from 0 through 10000 items, where each item is one non-fatal advisory string. |
| sampleResults | array | Yes | Bounded array of sample-match receipts with sample and matches properties. The item shape is defined by the nested schema and the array contains from 0 through 1000 items. |
API contract
POST /v1/executecurl -sS -X POST "$BASE/v1/execute" -H "Authorization: Bearer $KEY" -H 'Content-Type: application/json' -d '{"skillKey":"text.validate_regex","input":{"pattern":"^[a-z]+$","samples":["hello","WORLD"]}}'import { Squillify } from "@squillify/sdk";
const sq = new Squillify({ apiKey: process.env.SQUILLIFY_API_KEY });
const { output } = await sq.execute("text.validate_regex", {"pattern":"^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$","samples":["[email protected]","invalid@"]});Errors
| Code | HTTP | Retryable | Description |
|---|---|---|---|
| VALIDATION_ERROR | 400 | No | The request payload failed schema validation. |
| UNAUTHORIZED | 401 | No | Missing or invalid API key. |
| SKILL_NOT_ACCESSIBLE | 403 | No | The API key is not granted access to this skill. |
| SKILL_NOT_AVAILABLE_FOR_PLAN | 403 | No | This skill is not included in your current plan. |
| PLAN_ELIGIBILITY_UNAVAILABLE | 503 | Yes | Plan eligibility could not be decided. Retry after backoff. |
| SKILL_NOT_FOUND | 404 | No | The requested skill or version does not exist. |
| TENANT_RATE_LIMITED | 429 | Yes | Request rate limit exceeded. Retry after backoff. |
| QUOTA_EXCEEDED | 429 | Yes | Plan quota exhausted. Retryable once the quota period resets. |
| EXECUTION_TIMEOUT | 504 | Yes | Execution exceeded the allowed time budget. |
Other limits
| Limit | Value |
|---|---|
| Recommended inline bytes | 32 KiB |
Limitations
- Does not execute regex on production data at scale
- Does not support PCRE-only features (lookahead, backreferences)
- Does not replace or transform text — validation and testing only
- Executing regex on large production datasets (use extract_entities_regex instead)
- Complex PCRE patterns requiring lookahead or backreferences
- Text replacement or transformation tasks
How to call
POST /v1/execute (requires authentication)
{
"skillKey": "text.validate_regex",
"input": {
"pattern": "^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$",
"samples": [
"[email protected]",
"invalid@"
]
}
}Examples
Valid email pattern with samples
{
"pattern": "^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$",
"samples": [
"[email protected]",
"invalid@"
]
}{
"valid": true,
"sampleResults": [
{
"sample": "[email protected]",
"matches": true
},
{
"sample": "invalid@",
"matches": false
}
],
"warnings": [],
"engine": "re2j"
}Invalid syntax
{
"pattern": "[unclosed"
}{
"warnings": [],
"sampleResults": [],
"valid": false,
"syntaxError": "error parsing regexp: missing closing ]: `[unclosed`",
"engine": "re2j"
}Nested quantifiers earn a warning, not a rejection
{
"pattern": "(a+)+b",
"samples": [
"aaab"
]
}{
"valid": true,
"sampleResults": [
{
"sample": "aaab",
"matches": true
}
],
"warnings": [
"Pattern contains nested quantifiers — potential backtracking risk"
],
"engine": "re2j"
}Recommended use cases
- Validate agent-generated regex before deploying to extraction pipelines
- Pre-flight safety check for user-submitted patterns
- Test regex against sample strings to verify expected behavior
Avoid for
- Executing regex on large production datasets (use extract_entities_regex instead)
- Complex PCRE patterns requiring lookahead or backreferences
- Text replacement or transformation tasks
Related skills
Composable with
Safety & privacy
- Runs without calling any external service.
- Your payloads are never stored permanently.
- Telemetry captures metadata only — never your payload contents.
- We never train models on your payloads.
- No human reviews your payloads.