Regex test
Try it interactively →POST /api/regex-testTest a regex against an input string. Returns every match, the position, and any capture groups (named and numbered). Useful for debugging patterns.
Inputs
| Name | Type | Default | Description |
|---|---|---|---|
| pattern* | string | — | Regex pattern (without slashes). |
| text* | string | — | Text to search. |
| flags | string | "" | Regex flags (e.g. `i`, `im`, `iu`). The `g` flag is always added. |
Response
Modes: json. Cache: yes (24h TTL).
Code samples
Built from the emails example.
curl -X POST https://api.xtract.bot/api/regex-test \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "X-Account-Id: $XTRACT_ACCOUNT_ID" \
-H "X-Api-Key: $XTRACT_API_KEY" \
-d '{
"pattern": "([\\w.+-]+)@([\\w.-]+)",
"text": "Contact alice@example.com or bob+spam@test.io for details.",
"flags": ""
}'