How the tester works

Type a pattern, tick the flags you need, and paste the text to search — every keystroke re-runs the test. Nothing is submitted or uploaded: the pattern is compiled by your browser's own JavaScript engine and run against the text in this tab. The results panel shows the match count, your text with every match highlighted in place, and a card per match listing the full match, where it starts, and what each capture group caught — the save-run-inspect loop, compressed into typing.

What the results show

Quick answer: each match card shows the full matched text, its index — the position where the match starts, counting characters from 0 — and the value of every capture group in order. The highlighted view marks the same matches in place, so you can spot what the pattern caught and what it sailed past.

The index matters more than it looks. JavaScript positions count UTF-16 code units, so most characters count as one but many emoji count as two — worth knowing if you slice strings by the indexes shown here. Groups that took no part are shown as “did not participate”, because in code they come back as undefined. The JSON Formatter and URL Encoder/Decoder cover the formats regex work usually sits next to.

The five flags, explained

Flags are single letters that change how the whole pattern behaves. g — global — keeps searching after the first match; without it you only ever see match one. i ignores letter case, so cat matches Cat and CAT. m — multiline — makes ^ and $ match at line starts and ends too, which is what you want against logs and pasted documents. s — dotAll — lets . match line breaks as well; by default it stops at them. u switches on Unicode mode, so escapes and classes behave correctly beyond plain ASCII.

Regex cheat sheet

The tokens below cover most everyday patterns, in their JavaScript spellings.

TokenMatchesExample
\dA digit, 0–9\d{4} finds a four-digit year
\wA word character: letter, digit, underscore\w+ finds a whole word
\sWhitespace: space, tab, line break\s+ finds a gap of any size
.Any character except line breaksa.c finds “abc” or “a9c”
*Zero or more of the previous tokenab* matches “a”, “ab”, “abb”
+One or more of the previous token\d+ finds a whole number
?Zero or one; after a quantifier, makes it lazycolou?r matches “color”, “colour”
[…]Any one character in the set[aeiou] finds a vowel
(…)A capture group(\d+)-(\d+) splits a range in two
|Alternation — “or”cat|dog matches either word
^Start of text (or line, with m)^Hello matches only at the start
$End of text (or line, with m)end$ matches only at the end
\.A literal dot — escape specials with \example\.com matches the real dot

JavaScript flavour: what differs elsewhere

Regular expressions are a family, not a single language, and this tester speaks the JavaScript dialect. The core — classes, quantifiers, groups, anchors — is shared with PCRE (PHP and many tools) and Python's re, so most everyday patterns transfer unchanged. The differences hide in the corners: JavaScript writes named groups as (?<name>…) where Python writes (?P<name>…); PCRE offers possessive quantifiers and \K, which JavaScript lacks; lookbehind support varies by browser. If a pattern behaves differently in your app, a flavour difference is the first suspect — and if your app is JavaScript, this tester is the exact engine it runs.

Common mistakes

  • Leaving dots unescaped. In example.com the . matches any character, so it also matches exampleXcom. Write example\.com for a real dot.
  • Letting .* swallow the text. Quantifiers are greedy. Use a lazy .*? or a tighter class like [^"]* for quoted strings.
  • Forgetting anchors. An unanchored \d{4} finds four digits inside a 12-digit number. Add ^ and $ when the whole text must match.
  • Expecting . to cross lines. It stops at line breaks unless the s flag is on — the classic failure on pasted, multi-line text.
  • Nested quantifiers. Patterns like (a+)+$ can backtrack catastrophically on near-miss text. Simplify the inner group so the engine cannot retry the same ground.

Your text stays in your browser

Patterns and test text are processed by a script in this tab — nothing is uploaded, logged or stored, so the tester is safe for log lines and sample records you would not paste into a server-side tool. The page keeps nothing for you either, so copy your pattern or report before closing the tab.