Test a regular expression against your text
Write a pattern and see every match highlighted live, with capture groups broken out.
Regular expression tester
JavaScript syntax. Write the pattern only — no surrounding slashes.
/(?:)/ Matches
The pieces worth remembering
\ddigit,\wword character,\swhitespace. Capitalise to invert:\Dis any non-digit.*zero or more,+one or more,?zero or one,{2,5}between two and five.(...)captures,(?:...)groups without capturing,(?<name>...)captures by name.^start,$end,\bword boundary — the fix for matching "cat" inside "concatenate".(?=...)and(?!...)look ahead;(?<=...)and(?<!...)look behind.
Quantifiers are greedy by default: <.+> against <a><b>
matches the whole string, not just the first tag. Adding ? makes it lazy, so
<.+?> stops at the first closing bracket. This is the single most common
surprise in regular expressions.
Common questions
Which regex flavour does this use?
JavaScript's own, as implemented by your browser. That matters because flavours differ: lookbehind, named groups, and unicode property escapes are supported here but not in older engines, while features from PCRE such as recursion and possessive quantifiers do not exist in JavaScript at all.
What does the global flag actually change?
Without it, matching stops at the first match. With it, the pattern is applied repeatedly across the whole subject. It is the difference between replacing one occurrence and replacing all of them, and it is the flag people most often forget.
Why does the copied regex look slightly different from what I typed?
Flags are part of a regular expression literal, not separate from it, so the copy button gives you the whole thing in /pattern/flags form ready to paste into code. Any forward slash inside your pattern is also escaped, because an unescaped slash would end the literal early. The RegExp constructor does not need that escaping, which is why the copied form can differ by a backslash or two from what is in the box above.
Why does my pattern match nothing after I added ^?
The caret anchors to the start of the whole string, not the start of each line. Add the multiline flag and it anchors at every line break instead. The same applies to the dollar sign at the end.
Why did matching stop early?
Matching is capped at 1,000 matches and 250 milliseconds. Some patterns backtrack catastrophically — a classic example is nested quantifiers like (a+)+ against a long non-matching string — and because this runs on the page's main thread, an uncapped run would freeze the tab rather than merely be slow.
Is my test text uploaded?
No. Both the pattern and the subject stay in your browser. Nothing is sent to a server, logged, or stored.