Regex Tester Online – Test, Match & Replace

Local only

Test regular expressions, inspect every match, and replace text with JavaScript RegExp syntax locally.

40 chars · 3 lines

5 chars · 1 line

Pattern matched the inputFlags: g

Regex toolkit guide

How to test, match, and replace text with regular expressions

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

What you can do here

  • JavaScript RegExp syntax
  • Pass or fail regex testing
  • Match-all JSON output
  • Numbered and named capture groups
  • JavaScript replacement tokens
  • Browser-local processing

Steps

  1. Enter a regular expression pattern and optional JavaScript flags such as g, i, m, or s.
  2. Paste or type the text you want to test in the input panel.
  3. Choose Test, Match All, or Replace depending on the result you need.
  4. Review the result, captures, or replaced text before copying it into your code.

Test JavaScript regular expressions without running application code

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.

Inspect every match and capture group

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.

Preview JavaScript replacement syntax locally

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.

Regex match example

A named capture finds capitalized names followed by a four-digit year and returns the match positions and captures as JSON.

Pattern and test text

/(?<name>[A-Z][a-z]+):(\d{4})/g
Ada:1815 Grace:1906

Match result

[
  {
    "match": "Ada:1815",
    "index": 0,
    "captures": ["Ada", "1815"],
    "groups": { "name": "Ada" }
  },
  {
    "match": "Grace:1906",
    "index": 9,
    "captures": ["Grace", "1906"],
    "groups": { "name": "Grace" }
  }
]

Common questions

Frequently asked questions

Which regex flavor does VetaTool use?

The tool uses the browser's native JavaScript RegExp engine rather than PCRE, Python, RE2, or another regex flavor.

Does Match All require the g flag?

No. Match All temporarily adds the global flag for scanning when you omit it, without changing the flags stored in the workspace.

Can I test capture groups and named groups?

Yes. Match All includes numbered captures and named groups in the structured JSON output when the pattern defines them.

Is the text sent to a regex service?

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.