Test JavaScript regular expressions against your own text, inspect numbered and named capture groups, and preview replacements in real time. Everything runs locally in your browser.

Regular Expression

Enter the pattern only. Do not include leading or trailing / characters.

gu
IDLE Waiting for a pattern.

Test String

Paste, type, or load text to test against the expression.

0 characters · 0 lines Text files up to 5 MB

Highlighted Matches

Matches will appear here.

Matches & Capture Groups

No results yet.

Run a pattern to inspect matches and capture groups.

Replacement Preview

JavaScript replacement tokens are supported, including $&, $1, $<name>, $$, $`, and $'.

Enter a replacement to preview the result.

Stops a worker if the expression takes too long.

Prevents huge result sets from overwhelming the browser.

Regex evaluation runs in an isolated Web Worker with a timeout. Results follow the JavaScript RegExp behavior supported by your browser.

Your pattern and test text stay on your device. No text is uploaded to Flipper File, and this tool does not require an external JavaScript library.

Free Online Regex Tester and Validator

Use this JavaScript regex tester to validate a regular expression, test it against sample text, inspect capture groups, and preview replacements before using the expression in code. Matches are highlighted directly in the browser so it is easier to see exactly what the pattern is finding.

How to Use the Regex Tester

  1. Enter a regular expression pattern without surrounding slash characters.
  2. Enable the JavaScript flags you need, such as g for global matching or i for case-insensitive matching.
  3. Paste or type a test string. Matches and capture groups are calculated automatically, or click Run Regex Test.
  4. Optionally enter a replacement string to preview the result of JavaScript's String.replace() behavior.
  5. Copy matches or download them as TXT or JSON when you need to reuse the results.

JavaScript Regex Flags

g — Global

Find repeated matches instead of stopping after the first match.

i — Ignore case

Match letters without requiring the same uppercase or lowercase form.

m — Multiline

Changes how ^ and $ behave around line breaks.

s — DotAll

Allows the dot token to match newline characters.

u — Unicode

Uses Unicode-aware regular expression behavior.

y — Sticky

Requires matching to begin at the regex object's current lastIndex.

d — Indices

Exposes start and end indices for the full match and capture groups when supported.

v — Unicode Sets

Enables Unicode Sets features in browsers that support this newer JavaScript regex mode.

Common Regex Examples

Email address [A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,} Example: user@example.com
US phone number \(?\d{3}\)?[-.\s]?\d{3}[-.\s]?\d{4} Example: (555) 123-4567
IPv4-style address \b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b Example: 192.168.0.1
Hex color ^#(?:[0-9a-fA-F]{3}){1,2}$ Example: #FF5733
Date: YYYY-MM-DD \d{4}-\d{2}-\d{2} Example: 2026-09-16
JavaScript regex behavior can vary by browser.

The tester uses your browser's native JavaScript RegExp engine. Newer features such as the d and v flags only appear when the browser supports them. A pattern accepted by JavaScript is not automatically identical to PCRE, Python, .NET, Java, or other regex engines.

How to Use the Regex Tester

The Regex Tester lets you quickly check regular expressions against any block of text. Enter a pattern, toggle flags like g or i, and paste in your sample text. Matches are highlighted in real time, with captured groups and named groups displayed below for easy reference. You can also preview replacements, copy results, and download all matches in seconds. This tool is ideal for debugging patterns such as emails ([A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}), phone numbers, IP addresses, or custom data formats.

Common Regex Examples

  • Email Address
    [A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}
    Example match: user@example.com
  • US Phone Number
    \(?\d{3}\)?[-.\s]?\d{3}[-.\s]?\d{4}
    Example match: (555) 123-4567
  • IPv4 Address
    \b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b
    Example match: 192.168.0.1
  • Hex Color Code
    ^#(?:[0-9a-fA-F]{3}){1,2}$
    Example match: #FF5733
  • Date (YYYY-MM-DD)
    \d{4}-\d{2}-\d{2}
    Example match: 2025-08-27

Our Full Dev Tool Library

Flipper File