Regex Tester

Test JavaScript regular expressions with live match highlighting, capture group inspection, and replace mode. Runs entirely in your browser.

/ /
Flags: g global · i ignore case · m multiline · s dotall · u unicode · y sticky

What is a Regular Expression?

A regular expression (regex or regexp) is a compact language for describing patterns in text. Regexes are used for validation (email, phone, postcode), extraction (parsing logs, scraping data), and substitution (find & replace). Every major programming language and text editor has built-in regex support.

This tester uses the JavaScript RegExp engine — the same one running in Node.js and every modern browser. Patterns are compiled and executed entirely in your browser; nothing is sent over the network.

Common Regex Patterns

Quick Syntax Reference

Avoiding Catastrophic Backtracking

Patterns with nested quantifiers over overlapping characters — like (a+)+ or (\w+)*$ — can hit exponential time on certain inputs and freeze your browser. Prefer atomic structure: rewrite (\w+)* as \w*, and avoid alternations where both branches can match the same text.

Frequently Asked Questions

It uses the JavaScript / ECMAScript regex engine (the one built into your browser via the RegExp object). Most syntax is portable to PCRE, Python re, and Go regexp, but a few features differ — JavaScript supports lookbehind only in modern engines, does not support possessive quantifiers, and uses different named-group syntax than PCRE.
g = global (find all matches, not just the first); i = case-insensitive; m = multiline (^ and $ match line boundaries); s = dotall (. matches newlines too); u = unicode (full Unicode support, required for \p{} property escapes); y = sticky (match must start at lastIndex).
You probably hit catastrophic backtracking — patterns like (a+)+ or (a|a)* on long strings can cause exponential time complexity. The tester applies your regex synchronously, so a pathological pattern will freeze the tab. Avoid nested quantifiers over the same character class.
Wrap a portion of your pattern in parentheses: (\d{4})-(\d{2})-(\d{2}) captures year, month, and day as groups 1, 2, 3. Use (?<name>...) for named groups. In the replace field, reference them as $1, $2, or $<name>.
No. The pattern and test string are processed entirely in your browser using the built-in RegExp engine. Nothing is sent to any server.
Copied to clipboard!