Debug & Review · LOCAL TOOL
Regex Bench
Exercise a regular expression against text you control, inspect match ranges and capture groups, and preview a replacement without changing the original input.
No API call
Your input
LOCALResult
Run the tool to see a result.
Your result will appear here. Input is not saved.
WHY THIS TOOL EXISTS
A focused job, not a black box.
Each match includes start and end offsets so you can relate a result back to the source. The runner is isolated and has input, match-count, and time limits.
How to use it
- Enter a pattern and supported flags.
- Paste test text and an optional replacement.
- Review matches, groups, and the replacement preview.
TRY A WORKING EXAMPLE
Start with known input.
Load this sample into the workspace, run the tool, and compare the result shown below.
Show sample input
{
"pattern": "\\b(cat|dog)\\b",
"flags": "gi",
"text": "A cat and a dog.",
"replacement": "pet"
}Expected sample result from the local tool
2 match(es) · JavaScript string offsets.
{
"matches": [
{
"index": 2,
"end": 5,
"text": "cat",
"groups": [
"cat"
]
},
{
"index": 12,
"end": 15,
"text": "dog",
"groups": [
"dog"
]
}
],
"replacementPreview": "A pet and a pet."
}LIMITS AND INTERPRETATION
What the result cannot tell you.
The syntax follows JavaScript RegExp. Large or pathological expressions are terminated; Unicode offsets use JavaScript string indexing.
Inputs are processed in this page and are not written to local storage.