Regex Tester
Test regular expressions against text with match details and plain-English explanations
/v1/regex-test
curl -X POST "https://devtools.toolkitapi.io/v1/regex-test" \
-H "Content-Type: application/json" \
-d '{"pattern": "\\b[A-Z][a-z]+\\b", "text": "Hello World from Alice and Bob", "flags": "g"}'
import httpx
resp = httpx.post(
"https://devtools.toolkitapi.io/v1/regex-test",
json={"pattern": "\\b[A-Z][a-z]+\\b", "text": "Hello World from Alice and Bob", "flags": "g"},
)
print(resp.json())
const resp = await fetch("https://devtools.toolkitapi.io/v1/regex-test", {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({"pattern": "\\b[A-Z][a-z]+\\b", "text": "Hello World from Alice and Bob", "flags": "g"}),
});
const data = await resp.json();
console.log(data);
# See curl example
{
"valid": true,
"pattern": "\\b[A-Z][a-z]+\\b",
"flags": "g",
"match_count": 4,
"matches": [
{"match": "Hello", "start": 0, "end": 5, "groups": [], "named_groups": {}},
{"match": "World", "start": 6, "end": 11, "groups": [], "named_groups": {}},
{"match": "Alice", "start": 17, "end": 22, "groups": [], "named_groups": {}},
{"match": "Bob", "start": 27, "end": 30, "groups": [], "named_groups": {}}
],
"explanation": "`\\b` — Word boundary; `.` — Any character; `+` — One or more of the preceding"
}
Try It Live
Description
How to Use
1. Send a POST request with a JSON body containing `pattern` and `text`.
2. Add the `flags` field to control matching behaviour — `g` for global (all matches), `i` for case-insensitive, `m` for multiline, `s` for dotall, `x` for verbose.
3. Inspect the `matches` array for full details: the matched text, start/end positions, captured groups, and named groups.
4. Read the `explanation` field for a quick English breakdown of the regex tokens found in your pattern.
About This Tool
Regex Tester validates a regular expression pattern, runs it against your text, and returns detailed match information including character positions, capture groups, named groups, and a plain-English explanation of the pattern's components.
The tool uses Python's `re` module under the hood, which supports a PCRE-like syntax. You can run a single match (default) or use the `g` flag for global matching to find every non-overlapping occurrence.
Why Use This Tool
- Regex debugging — Verify patterns before embedding in application code or CI pipelines
- Data extraction testing — Test extraction patterns against sample log lines, CSVs, or HTML snippets
- Learning tool — Read the `explanation` field to understand common regex syntax tokens
- Pattern validation — Quickly check if a regex compiles without errors before deploying config changes
Frequently Asked Questions
Which regex flavor is used?
What does the `g` flag do?
Can I use named groups?
Start using Regex Tester now
Get your free API key and make your first request in under a minute.