Regex Tester

Type a pattern and see every match highlighted as you go, with capture groups, a replace preview and a plain-English breakdown of each token.

Test text · 3 matches

Replace
[No. 412] x3 — ready
[No.413] x1 — pressing
No. 99 · 2 garments — too short to match
[No. 4140] x5 — received

What this pattern means

  1. (?<ticket>start of capture group 1, named “ticket”
  2. Nothe text “No”
  3. \.a literal “.”
  4. \swhitespace (space, tab, newline…)
  5. ?…repeated optional (zero or one time)
  6. \da digit (0–9)
  7. {3,4}…repeated between 3 and 4 times
  8. )end of group
  9. \swhitespace (space, tab, newline…)
  10. +…repeated one or more times
  11. ·the character “·”
  12. \swhitespace (space, tab, newline…)
  13. +…repeated one or more times
  14. (start of capture group 2
  15. \da digit (0–9)
  16. +…repeated one or more times
  17. )end of group
  18. garmentthe text “ garment”
  19. sthe character “s”
  20. ?…repeated optional (zero or one time)

Ask AI

Get a fuller explanation of the current pattern, or describe what you want to match and get a pattern loaded into the tester.

Use it in JavaScript

const re = /(?<ticket>No\.\s?\d{3,4})\s+·\s+(\d+) garments?/g;
const matches = [...text.matchAll(re)];

How to use the regex tester

  1. Type your pattern between the slashes — no need to escape the slashes themselves.
  2. Toggle flags: g all matches, i ignore case, m ^ and $ per line, s dot matches newlines, u Unicode, y sticky.
  3. Paste test text. Matches highlight instantly; the table lists each match, its position and its groups.
  4. Open Replace to preview String.replace with $1, $<name> and $&.

Which regex flavour is this?

JavaScript (ECMAScript 2024), exactly what new RegExp() does in your browser and in Node.js. It supports lookbehind, named groups and Unicode property escapes like \p{L}. PCRE (PHP), Python and Java are very similar for everyday patterns; the differences are mostly in advanced features such as possessive quantifiers, atomic groups and inline flags, which JavaScript lacks.

Explain and generate with AI

The token breakdown is computed instantly on the page. For a fuller, contextual explanation — or to describe what you want in words and get a pattern — use the AI buttons. The result is loaded into the tester so you can verify it against real text before you trust it.

Questions

Is this like regex101?

It covers the same core job for JavaScript regex — live highlighting, groups, flags, substitution and an explanation — on a lighter page that also works on a phone.

Why does my pattern match an empty string forever?

Patterns such as a* can match zero characters. The tester advances past empty matches so the page never hangs, and shows them as zero-width markers.

Are my patterns saved?

Your last pattern, flags and test text are kept in this browser (localStorage) so they’re there when you come back. Clear them from the privacy page or with the Clear button.

How do I match a literal dot or bracket?

Escape it with a backslash: \., \[, \(. See the regex cheat sheet for the full list.

Related tools