2026topopentools

Regex Tester

Test your regular expressions live against any text, with match highlighting, flag toggles, and a capture-group breakdown.

//g

Understanding the Regex Tester

This tool lets you write a regular expression, run it against sample text, and instantly see every match, capture group, and named group it produces. Regular expressions are compact patterns for finding, validating, and extracting text, used in code, search-and-replace, form validation, and log parsing. The live results help you understand exactly what a pattern does before you ship it. It suits developers, data wranglers, and anyone learning regex who wants fast feedback and a clear breakdown of matches without setting up a coding environment.

How it works

You supply a pattern and flags (such as g for global, i for case-insensitive, m for multiline), and the tool compiles them with the JavaScript RegExp engine in your browser. It runs the pattern over your test string, highlights each match in place, and lists the full match plus every numbered and named capture group with its index. Because it uses the native engine, behavior matches JavaScript and ECMAScript environments. Everything executes locally, so your patterns and test data never leave the page. Watch the flag settings, as they change whether you get one match or all of them.

Worked example

Test the pattern (\d{4})-(\d{2})-(\d{2}) with the g flag against "Invoices: 2024-01-15 and 2025-06-30". You get two matches. The first match is 2024-01-15 with group 1 = 2024, group 2 = 01, group 3 = 15; the second is 2025-06-30 with groups 2025, 06, 30. Add the i flag for case-insensitive matching, or name a group with (?<year>\d{4}) to read it back by name instead of by number.

Tips & common mistakes

  • Without the global (g) flag you only get the first match; add it to see all of them.
  • Engines differ. This uses JavaScript regex, so lookbehind and some Unicode features may behave differently from PCRE, Python, or .NET.
  • Escape special characters like . ( ) [ ] { } + * ? with a backslash when you mean them literally.
  • Anchor with ^ and $ for full-string validation; otherwise a pattern can match just part of the input.
  • Avoid catastrophic backtracking from nested quantifiers like (a+)+ on long inputs; it can hang the page.

Related tools

Frequently Asked Questions

Which regex flavor is this?

JavaScript (ECMAScript) regular expressions, using your browser's native RegExp engine — the same one that runs in web apps and Node.js.

What do the flags do?

g matches all occurrences, i ignores case, m makes ^ and $ match line boundaries, and s lets the dot match newlines.

Does it show capture groups?

Yes. When your pattern has capture groups, a table lists each match with the values captured by each group.