ToolCozy
JSON Format / DiffHOTBase64 CodecHOTURL CodecNEWTimestamp ConverterNEWUUID GeneratorHash CalculatorJWT DecoderQR Code GeneratorUnit ConverterNumber BaseData ConverterSQL FormatterIP Lookup
Image CompressHOTColor ConverterImage ConvertImage CropNEWApp Store ScreenshotNEW
Regex TesterNEWWord CounterText DiffMarkdown Preview

More Products

Playbit Games

Free online HTML5 games — play instantly in your browser

Kaola Screenshot

App Store screenshot generator with device frames & templates

Pillease

Simple pill reminder app — never miss a dose again

© 2026 ToolCozy·Privacy·Feedback

Regex Tester

Regex editor with match highlighting & capture groups

//g
Flags:
About this tool

A regex tester lets you build, debug, and verify regular expressions interactively — paste your test text, type your pattern, and watch matches highlight in real time without flipping through documentation.

This tool uses the JavaScript regex flavor (the same one your browser and Node.js run). It supports all standard flags (g, i, m, s, u, y), highlights every match, and breaks out each capture group so you can confirm the structure of complex patterns.

How to use

Build & test a pattern

  1. Type or paste your regex into the pattern box (no leading/trailing slashes — flags are toggled with the buttons next to it).
  2. Toggle flags: g for all matches, i for case-insensitive, m for multi-line ^/$, s for . matching newline, u for full Unicode, y for sticky.
  3. Paste sample text. Matches highlight inline; capture groups appear in a list below.
  4. Use the templates (email, URL, phone, etc.) as a starting point if you don't want to write from scratch.

Examples

Capture domain from email

Input
Pattern: ([a-z0-9._%+-]+)@([a-z0-9.-]+\.[a-z]{2,})
Flags:   gi
Text:    Contact [email protected] or [email protected]
Output
Match 1: [email protected]
  Group 1: alice
  Group 2: toolcozy.com
Match 2: [email protected]
  Group 1: bob
  Group 2: example.org

Find all numbers

Input
Pattern: \d+
Flags:   g
Text:    Order 12 of 350 shipped on day 7
Output
Matches: 12, 350, 7
Frequently asked questions
Which regex flavor does this use?

JavaScript / ECMAScript. That means lookbehind ((?<=…)) is supported in modern browsers, named groups ((?<name>…)) work, but PCRE-specific features like recursion and possessive quantifiers do not.

What do the flag letters mean?

g = find all matches (not just the first). i = case-insensitive. m = ^ and $ match per line. s = . also matches newlines. u = full Unicode (including surrogate pairs and \p{} property classes). y = sticky (matches only at lastIndex).

My pattern has no matches but I think it should — why?

Common causes: forgetting the g flag (only first match shown), using \ in HTML-escaped form (need a single backslash in the pattern field), confusing greedy and lazy quantifiers, or the test text actually doesn't contain what you think (extra spaces, smart quotes, etc.).

Will a complex regex hang my browser?

It can. Patterns with nested quantifiers like (a+)+ on a long input cause catastrophic backtracking — the regex engine tries exponentially many combinations. If your test text is small you'll be fine here, but never run such patterns on user input in production.

Are named capture groups supported?

Yes — (?<year>\d{4}) creates a named group. The matched value also shows up by index, so older code that uses match[1] still works.