Skip to content
UtilSprout

Developer Tools

Regex Tester

Test JavaScript-compatible regex patterns against local text with live highlighting, match positions, capture groups, named groups and replacement previews. Evaluation runs in a disposable worker with bounded input and a timeout.

🔒 Your files and data never leave your device
Flags
Example patterns

These are practical examples, not universal validators for every valid real-world value.

Evaluation runs in a disposable browser worker with bounded inputs and a timeout. No pattern or test text is uploaded.

Simple workflow

How to use Regex Tester

  1. 1Enter a JavaScript regular expression pattern and select the flags you need.
  2. 2Paste test text and review highlighted matches, positions and capture groups.
  3. 3Enable Replace mode to preview standard JavaScript replacement syntax.

Good to know

Frequently asked questions

Which regex engine is used?

The tool uses the JavaScript RegExp engine available in your browser, including supported g, i, m, s, u, y and d flags.

Can a pattern freeze the page?

Evaluation runs in a separate disposable worker with input limits and a short timeout. Extremely costly patterns are terminated, although no browser safeguard can prove every regex safe in advance.

Are the example patterns complete validators?

No. They demonstrate common syntax and useful matching approaches, but formats such as email and URL have edge cases beyond a short example.

Is test text uploaded?

No. Patterns, text, matches and replacement previews stay in this browser.

Practical guide

Test JavaScript regex behavior with bounded execution

A regular expression describes text patterns. Flags change how the browser scans: g finds repeated matches, i ignores case, m changes line anchors, s lets dot include newlines, u enables Unicode semantics, and y makes matching sticky at the current position.

Replace mode uses JavaScript replacement tokens such as $&, $1 and $<name>. The preview uses the same browser RegExp behavior as the matcher. Patterns and text run in a disposable Web Worker so a costly expression can be terminated instead of locking the interface indefinitely.

Worked example

Reformat a named date

Start with
Text: 2026-09-17; pattern: (?<year>\d{4})-(?<month>\d{2})-(?<day>\d{2}).
Choose
Enable Replace mode and enter $<day>/$<month>/$<year>.
You get
The match lists named groups and the preview shows 17/09/2026.

Tips for a useful result

  • Escape a literal dot as \.
  • Use non-greedy quantifiers when a greedy match spans too much text.
  • Treat the supplied email and URL patterns as examples rather than standards-complete validators.

Safety boundaries

Patterns, test text and replacement strings have explicit length limits. Matching stops after 5,000 results, and a worker that exceeds the execution window is terminated. The tool constructs RegExp objects only; it never evaluates arbitrary JavaScript.

Keep going

Related tools

View all →