
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.
Test String
Paste, type, or load text to test against the expression.
Highlighted Matches
Matches will appear here.
Matches & Capture Groups
No results yet.
Replacement Preview
JavaScript replacement tokens are supported, including $&, $1, $<name>, $$, $`, and $'.
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
- Enter a regular expression pattern without surrounding slash characters.
- Enable the JavaScript flags you need, such as
gfor global matching orifor case-insensitive matching. - Paste or type a test string. Matches and capture groups are calculated automatically, or click Run Regex Test.
- Optionally enter a replacement string to preview the result of JavaScript's
String.replace()behavior. - Copy matches or download them as TXT or JSON when you need to reuse the results.
JavaScript Regex Flags
Find repeated matches instead of stopping after the first match.
Match letters without requiring the same uppercase or lowercase form.
Changes how ^ and $ behave around line breaks.
Allows the dot token to match newline characters.
Uses Unicode-aware regular expression behavior.
Requires matching to begin at the regex object's current lastIndex.
Exposes start and end indices for the full match and capture groups when supported.
Enables Unicode Sets features in browsers that support this newer JavaScript regex mode.
Common Regex Examples
[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,} Example: user@example.com\(?\d{3}\)?[-.\s]?\d{3}[-.\s]?\d{4} Example: (555) 123-4567\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b Example: 192.168.0.1^#(?:[0-9a-fA-F]{3}){1,2}$ Example: #FF5733\d{4}-\d{2}-\d{2} Example: 2026-09-16 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
