Regex Tester
Test JavaScript regular expressions in real time with live match highlights, capture groups, ECMAScript flags, replacement previews, and test cases.
Support VClick Tools
VClick Tools is 100% free with no subscriptions or paid plans. If this saved you time, you can buy us a coffee to keep development going.
Support VClick Tools100% optional • Securely processed via Buy Me a CoffeeWhat Is a Regex Tester?
How to Test a Regular Expression
g or Case-Insensitive i), and input your test text. The tool immediately evaluates the expression using your browser's native JavaScript engine.JavaScript Regex Syntax
. ^ $ * + ?), character classes ([a-z0-9]), character class escapes (\d, \w, \s), and quantifiers ({min,max}).new RegExp(pattern, flags), guaranteeing that tested patterns behave identically to execution in modern browsers and Node.js backend servers.Regex Patterns and Test Strings
g flag, the engine halts after locating the first match.g flag is active, the engine advances iteratively through the string, finding all non-overlapping matches and handling zero-length boundary matches (such as \b or ^) safely without infinite loops.JavaScript Regex Flags
g (Global), i (Ignore Case), m (Multiline), s (DotAll), u (Unicode), v (Unicode Sets), y (Sticky), and d (Has Indices).Global, Ignore Case, and Multiline Flags
g flag finds all matches across the entire input rather than stopping after the first occurrence. The i flag performs case-insensitive comparisons, treating uppercase and lowercase letters as equivalent.m flag alters the behavior of anchor assertions ^ and $, causing them to match the beginning and end of each individual line (separated by \n or \r\n) rather than only the start and end of the entire string.DotAll, Unicode, and Unicode Sets
s (DotAll) flag allows the wildcard . to match line terminator characters (\n, \r), enabling cross-line matching without cumbersome [\s\S] constructs.u flag enables full Unicode code point support and \p{...} Unicode property escapes. The newer v flag (Unicode Sets) extends this with set subtraction, intersection, and multi-character string properties inside character classes.Sticky and Has Indices Flags
y (Sticky) flag instructs the regex engine to attempt matching only starting at the exact position indicated by the regex object's lastIndex property, commonly used in high-performance lexical parsers.d flag instructs the engine to generate start and end slice index arrays for both full matches and all capturing groups, enabling precise coordinate tracking.Capturing Groups
(...). When a match occurs, the engine extracts the matched substring for each group, making them accessible via $1, $2, or array indices.(?:...) allow grouping without storing extracted substrings, optimizing performance when sub-expressions are used solely for alternation or quantifiers.Named Capturing Groups
(?<name>pattern), assigning explicit semantic identifiers to extracted data rather than relying on brittle numeric indices.$<name>), making complex data extraction logic self-documenting.Match Positions and Indices
Lookahead and Lookbehind
(?=...) and negative lookahead (?!...) assert conditions ahead of the current position.(?<=...) and negative lookbehind (?<!...), allowing developers to assert preceding prefixes (such as matching currency values following $).Regex Replacement
$& (entire match), $1-$99 (numbered capture groups), $<name> (named capture groups), and $$ (literal dollar sign).Testing Multiple Cases
Common JavaScript Regex Errors
[, unclosed group parentheses (, trailing escape backslashes \, and invalid quantifier ranges {5,2}.SyntaxError exceptions emitted by the JavaScript engine and displays clear, actionable error descriptions.Unicode and International Text
[a-zA-Z] fail on non-Latin scripts.u flag with Unicode property escapes (\p{L} for letters, \p{N} for numbers) ensures robust, internationalized text validation.Regex Performance and Large Inputs
(a+)+$) can suffer from Catastrophic Backtracking (ReDoS), causing exponential execution times on non-matching strings.Browser-Based Regex Testing and Privacy
Frequently Asked Questions
Common questions about Regex Tester and how it works.
How to Test a Regular Expression Online
- 1Enter Pattern and Flags
Type your regular expression into the pattern field and toggle desired JavaScript flags (such as g, i, m, or u).
- 2Provide Test String
Paste your sample text, log lines, or data strings into the test area, or load a local text file up to 5 MB.
- 3Inspect Visual Highlights
Review instant color-coded match highlights and verify matched string boundaries.
- 4Analyze Capture Groups
Inspect extracted numbered and named capture groups alongside character indices and match lengths.
- 5Test Replacements and Assertions
Switch to Replace mode to preview string substitutions or run automated PASS/FAIL test cases.
Was this tool useful?
Your feedback helps us improve VClick Tools.
