Regex Tester & Debugger
Test and debug regular expressions with live match highlighting. Supports all JavaScript regex flags.
What Is a Regular Expression?
A regular expression (regex or regexp) is a sequence of characters that defines a search pattern. Regex engines use these patterns to search, validate, extract, and transform text. For example, the pattern [A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,} with the i flag matches email addresses. Regular expressions are supported in virtually every modern programming language and are one of the most powerful text-processing tools available to developers.
This tool uses the JavaScript (ECMAScript) regex engine, which supports named capture groups, lookbehind assertions, the s (dotAll) flag, and Unicode property escapes. Patterns tested here work directly in JavaScript, TypeScript, Node.js, and all modern browsers.
JavaScript Regex Flags
g— global: find all matches, not just the first.i— case-insensitive: ignore upper/lower case differences.m— multiline: make^and$match the start/end of each line, not just the whole string.s— dotAll: allow.to match newline characters (\n).u— unicode: full Unicode mode for characters outside the basic multilingual plane.y— sticky: anchor the search at thelastIndexposition of the RegExp object.
Common Regex Syntax
.— any character except newline (withsflag, includes newlines).\d/\D— digit / non-digit.\w/\W— word character (letter, digit, underscore) / non-word.\s/\S— whitespace / non-whitespace.^/$— start / end of string (or line withmflag).*,+,?— zero or more, one or more, zero or one (greedy).{n,m}— between n and m repetitions.[abc]— character class: a, b, or c.[^abc]— any character except a, b, c.(abc)— capturing group.(?:abc)— non-capturing group.(?=abc)/(?!abc)— positive / negative lookahead.(?<=abc)/(?<!abc)— positive / negative lookbehind.a|b— alternation: a or b.
Frequently Asked Questions
What does "greedy" mean in regex?
Quantifiers like *, +, and {n,m} are greedy by default — they match as many characters as possible. Adding ? makes them lazy, matching as few as possible. For example, <.+> greedily matches the whole string <b>text</b>, while <.+?> lazily matches just <b>.
Do patterns work in Python or PHP?
Most basic syntax (character classes, quantifiers, groups) is compatible across engines. However, there are differences: Python uses its own re module with different flag syntax; PHP uses the PCRE engine. Always verify patterns in your target environment before using them in production.
How is my regex data handled?
No. For supported tools, pattern testing happens locally in your browser whenever possible.