Avexora Tools

Regex Tester

Free regex tester. Try JavaScript regular expressions against sample text and see every match with its index and capture groups — with clear error messages.

About the Regex Tester

A regex tester that lets you test JavaScript regular expressions against sample text to see matches, indices, and capture groups in real-time.

This tester runs your pattern against any text and reports every match: what matched, at which character index, and what each capture group contains. Regular expressions are the power tool of text processing — and famously easy to get subtly wrong. The difference between a pattern that works and one that corrupts data in production is usually one escape or one greedy quantifier, which is why experienced developers never ship a regex they haven't tested against realistic samples.

It uses JavaScript's regex engine, so what works here works in Node.js and every browser (and mostly everywhere else — the core syntax is shared across languages). All the standard flags are supported: i for case-insensitive, m to make ^ and $ match line boundaries, s to let the dot cross newlines, u for proper Unicode handling. Matches are always listed globally so you see every occurrence, and capture groups — the parenthesised sub-patterns you'll use to extract or reorder text — are printed per match, which is where extraction bugs actually hide.

A sound testing habit: paste text that includes both strings that should match and near-misses that shouldn't. A pattern for 6-digit Indian PINs should match 110001 but reject 11000 and 1100011 — testing only the happy case is how catastrophic replacements happen. Invalid patterns return the engine's actual error message rather than a shrug, and everything runs locally, so testing against production log excerpts is safe.

How to use the Regex Tester

  1. Enter your regular expression pattern in the Pattern field (without the leading/trailing slashes).
  2. Optionally add flags like 'g' for global or 'i' for case-insensitive.
  3. Paste the text you want to test into the Test text field.
  4. Click 'Test pattern' to view all matches, their positions, and captured groups.

Worked example

Enter the pattern '\b\d{6}\b', flag 'g', and text 'My PIN is 110001'. The tester will highlight '110001' as a match.

Frequently asked questions

Which regex flavour does this use?
JavaScript's (ECMAScript). Patterns behave exactly as they will in Node.js and browsers. Core syntax carries over to Python, Java and Go, though advanced features like lookbehind vary by engine.
What are capture groups?
Parenthesised parts of a pattern that extract sub-matches — in (\d{2})-(\d{2}), group 1 and group 2 capture the two number pairs separately. The tester prints each group's content for every match.
Why does my pattern match too much?
Usually a greedy quantifier: .* grabs as much as possible. Use the lazy form .*? or a more specific character class like [^,]* to stop at the right boundary.
What does the 'g' flag do?
The 'g' (global) flag tells the regex engine to find all matches in the text, rather than stopping after the first match. The tester automatically displays all occurrences found.
Is it safe to paste private logs here?
Yes, testing happens entirely in your browser using the local JavaScript engine. No patterns or text are ever sent to a server.

More from Avexora

All Avexora products →

Business software from the team behind these free tools.

Get one practical business tip every week

Tools, templates and tactics for running your business — free, no spam.

Related tools

More developer & web utilities