Testing Tools

Regex Tester

Test regular expressions in real time. See matches highlighted, capture groups, and flags with instant feedback.

Your data never leaves your browser — nothing is sent to any server.

//g
gims
Presets:EmailURLIPv4PhoneDate (YYYY-MM-DD)Hex Color
How to use
  1. 1

    Enter your regex pattern

    Type your regular expression in the pattern field. The delimiters (/ /) are shown automatically — just type the pattern itself. Use the preset buttons to insert common patterns like email, URL, or IP.

  2. 2

    Set your flags

    Click the flag badges (g, i, m, s) to toggle them on or off. Global (g) is enabled by default to find all matches.

  3. 3

    Enter test text

    Type or paste the text you want to test against in the test string area. Matches are highlighted in real time as you type.

  4. 4

    Review matches and groups

    The highlighted view shows matches in green. The match details section lists each match with its index position and capture groups. Click Copy to copy the full regex with flags.

Common errors

Unterminated group or character class

Every opening parenthesis ( must have a closing ), and every opening bracket [ must have a closing ]. Check for unmatched or missing closers. If you need to match a literal parenthesis or bracket, escape it with a backslash: \( or \[.

Nothing to repeat (quantifier without target)

Quantifiers like *, +, ?, and {n} must follow a character, group, or character class. Patterns like *abc or +test are invalid because the quantifier has nothing to repeat. Place the quantifier after the element: a*bc or test+.

Invalid escape sequence

Not all characters need escaping. In JavaScript regex, \b, \d, \w, \s, etc. are valid escape sequences. But \q or \j are invalid. If you want to match a literal backslash, use \\. Common mistake: using \. when you mean a literal dot — this is actually correct and necessary.

FAQ (6)
What regex flavor does this tester use?

This tool uses JavaScript's built-in RegExp engine, which implements the ECMAScript specification. It supports features like lookahead (?=), lookbehind (?<=), named capture groups (?<name>), Unicode property escapes (\p{}), and the dotAll (s) flag. It does not support PCRE-only features like recursive patterns or atomic groups.

What do the flags g, i, m, and s mean?

g (global) finds all matches instead of stopping at the first. i (case-insensitive) ignores letter case. m (multiline) makes ^ and $ match line boundaries instead of just the start/end of the entire string. s (dotAll) makes the . metacharacter match newline characters, which it normally skips.

How do capture groups work?

Parentheses (...) create capture groups that extract sub-matches. For example, the pattern (\d{4})-(\d{2})-(\d{2}) against '2024-01-15' captures three groups: '2024', '01', and '15'. Each match displays its capture groups below the match value in the details panel.

Why does my regex cause the browser to freeze?

Catastrophic backtracking occurs when a regex has nested quantifiers that create exponentially many paths to try. Patterns like (a+)+ or (a|a)* on long input can take billions of steps. Simplify your quantifiers, use atomic groups or possessive quantifiers where supported, and avoid nested repetitions.

Is my regex and test data sent to a server?

No. All matching happens locally in your browser using the native RegExp engine. Your patterns and test strings never leave your device. There are no network requests, no logging, and no server-side processing.

Can I test multi-line strings?

Yes. Paste multi-line text into the test string area and enable the m (multiline) flag if you want ^ and $ to match at line boundaries. Enable the s (dotAll) flag if you want . to match across newlines.

Learn more

Regex Tester — Test Regular Expressions in Real Time

Regular expressions are one of the most powerful and widely used tools in a developer's arsenal. From form validation and data extraction to log parsing and search-and-replace operations, regex appears in virtually every programming language, text editor, and command-line tool. This free regex tester lets you write, test, and debug regular expressions with instant visual feedback — all in your browser.

How This Tester Works

The tool uses JavaScript's native RegExpengine, which implements the ECMAScript regex specification. When you type a pattern, it's compiled into a RegExp object in real time. The test string is then scanned for matches using RegExp.prototype.exec() in a loop (for global mode), and each match is highlighted visually and listed with its index position and capture groups. Invalid patterns are caught immediately and displayed as error messages.

Understanding Regex Flags

Flags modify how the regex engine processes the pattern. The global flag (g) is essential for finding all occurrences rather than just the first. Case-insensitive (i) is critical for user input validation where letter case varies. Multiline (m) changes the behavior of ^ and $ to match at line boundaries — invaluable when processing log files or multi-line configuration. DotAll (s) makes . match newline characters, enabling patterns that span across lines.

Common Regex Use Cases

Email validation, URL extraction, phone number formatting, IP address matching, date parsing, and log file analysis are among the most common applications. DevOps engineers use regex in grep, sed, and awk for log analysis. Frontend developers use regex for form validation and input masking. Backend engineers use regex for route matching, request parsing, and data transformation pipelines. This tester includes preset patterns for the most frequently needed patterns.

Capture Groups and Extraction

Parentheses in regex create capture groups that extract specific portions of a match. For example, the pattern (\d{4})-(\d{2})-(\d{2}) against a date string captures the year, month, and day separately. Named capture groups ((?<year>\d{4})) make the extracted data self-documenting. This tester displays all capture groups for every match, making it easy to verify that your extraction logic works correctly before deploying it.

Avoiding Catastrophic Backtracking

The most dangerous regex pitfall is catastrophic backtracking, where certain patterns cause the engine to explore an exponential number of paths. Patterns like (a+)+, (a|a)*, or (.*a){10} on long input can hang the browser or server for minutes. The solution is to avoid nested quantifiers, use atomic groups where supported, and prefer specific character classes over broad wildcards. Testing with this tool helps catch performance issues before they hit production.

Privacy and Security

This regex tester runs entirely in your browser. Your patterns and test strings never leave your device — there are no API calls, no server processing, and no data logging. This makes it safe to test patterns against sensitive data like email addresses, API keys, or internal identifiers without any risk of exposure.