40 chars · 3 lines
5 chars · 1 line
40 chars · 3 lines
5 chars · 1 line
Regex toolkit guide
Enter a JavaScript regular expression pattern and flags above, then test sample text, inspect every match with capture groups, or replace matching text. VetaTool runs the RegExp engine locally in your browser, so logs, snippets, and copied text are not uploaded. This tool is free to use. No account or payment is required.
Last updated
The Regex tool uses the browser's native JavaScript RegExp implementation. That means character classes, groups, lookarounds, Unicode behavior, and replacement tokens follow the same language rules you would use in frontend or Node.js JavaScript.
Invalid patterns or unsupported and duplicate flags are reported before a result is produced, which makes the workspace useful for checking syntax separately from the surrounding application logic.
Match All returns structured JSON containing the matched text, zero-based index, numbered capture groups, and named groups when the pattern defines them. If the global flag is omitted, VetaTool adds it only for the scan so every match can still be inspected.
Zero-length matches are advanced safely while scanning, preventing a manual RegExp.exec loop from getting stuck on the same character position.
Replace mode delegates to JavaScript String.replace, so replacement tokens such as $&, $1, $2, and named capture references keep native JavaScript behavior. Whether one or every occurrence is replaced still depends on the selected flags.
Pattern testing, match inspection, replacement, copy, file import, and local history all stay on the device.
A named capture finds capitalized names followed by a four-digit year and returns the match positions and captures as JSON.
/(?<name>[A-Z][a-z]+):(\d{4})/g
Ada:1815 Grace:1906[
{
"match": "Ada:1815",
"index": 0,
"captures": ["Ada", "1815"],
"groups": { "name": "Ada" }
},
{
"match": "Grace:1906",
"index": 9,
"captures": ["Grace", "1906"],
"groups": { "name": "Grace" }
}
]Common questions
The tool uses the browser's native JavaScript RegExp engine rather than PCRE, Python, RE2, or another regex flavor.
No. Match All temporarily adds the global flag for scanning when you omit it, without changing the flags stored in the workspace.
Yes. Match All includes numbered captures and named groups in the structured JSON output when the pattern defines them.
No. Pattern compilation, matching, replacement, and result generation run locally in your browser.
Looking for broader references? Browse all developer guides.
Debugging a specific Regex issue? Browse Regex troubleshooting.