Privatool

Regex Tester – Test Regular Expressions Online Free

Regex Tester is a free online tool for testing and debugging JavaScript regular expressions in real time. Enter a pattern and test string to see live colour-highlighted matches, capture group values, and match indices — all updated within 200ms of each keystroke. Includes a replace mode and six common preset patterns.

Loading tool…

How to Test a Regex Online

  1. 01

    Enter your pattern

    Type a regex pattern, choose flags, or click a preset. Syntax errors are shown immediately below the input field.

  2. 02

    Paste test text

    Type or paste the string to test against. Matches are highlighted in colour within 200ms. The match list shows index, value, and capture groups.

  3. 03

    Use Replace if needed

    Enter a replacement string (supports $1 group references) and click "Replace All" to see the transformed output.

Features

  • Live match highlighting (200ms debounce)
  • Flag toggles: g, i, m, s
  • Match list with index and capture groups
  • Replace mode with $1 group references
  • 6 common regex presets (email, URL, IPv4…)
  • Real-time syntax error display
  • 100% client-side — native JS RegExp
  • No login, no data sent to server

Frequently Asked Questions

Which regex flavour does this tool use?

The tool uses JavaScript's native RegExp engine, which is ECMAScript-standard. This means it supports most common syntax: character classes (\d \w \s), quantifiers (+ * ? {n,m}), anchors (^ $), groups ((...)), non-capturing groups ((?:...)), lookaheads ((?=...) (?!...)), and the flags g (global), i (case-insensitive), m (multiline), and s (dotAll).

What do the flag toggles do?

The g (global) flag finds all matches instead of stopping at the first. The i flag makes the match case-insensitive. The m flag makes ^ and $ match at the start and end of each line rather than the whole string. The s (dotAll) flag makes the dot (.) match newline characters, which it normally ignores.

How does the Replace feature work?

Enter a replacement string in the Replace field and click "Replace All". JavaScript's String.replace() is used with the full regex. You can use $1, $2, etc. to insert capture group values into the replacement, or $& to insert the whole match.

What are the preset patterns?

Six common patterns are provided: Email, URL, Phone, IPv4 address, Date (YYYY-MM-DD), and Hex Color. Click any preset to load it into the pattern field. These are starting points — you can edit them to suit your needs.

Does the tool support lookbehind assertions?

Lookbehind assertions ((?<=...) and (?<!...)) are supported in modern browsers (Chrome 62+, Firefox 78+, Safari 16.4+). If your browser is older, they will produce a syntax error. The tool displays the browser's native error message, which makes it easy to diagnose unsupported syntax.

Related Tools