Irreva logo
Explore Irreva
DeveloperMarch 15, 2026· 5 min read· Updated June 10, 2026

How to Test Regular Expressions Online

Hasanur Rahman

Written by Hasanur Rahman

Founder & Full-Stack Developer · Irreva · Rangpur, Bangladesh

Writing regex by trial and error is painful without immediate feedback. An online regex tester shows you which parts of your test string match as you type, highlights capture groups, and tells you instantly when a change breaks something. This guide walks through how to use a regex tester effectively and the features you should look for.

What a regex tester shows you

A good regex tester has three main areas: the pattern input, the test string, and the results. The results show all matches highlighted within the test string, the number of matches found, and the content of any capture groups.

Real-time feedback is the key feature. As you type or edit the pattern, the matches update instantly. This lets you build patterns incrementally — start with a literal match, add quantifiers, add anchors, and see exactly what you've captured at each step.

Capture groups are shown separately so you can confirm exactly what each group extracts. Named groups ((?<year>\d{4})) make this even clearer — the group name appears alongside the matched value.

Regex flags and when to use them

The global flag (g) matches all occurrences, not just the first. Without it, match() returns only the first match. In the tester, always use g to see all matches in your test string.

The case-insensitive flag (i) makes the pattern match regardless of letter case. The pattern /hello/i matches 'hello', 'Hello', 'HELLO', and 'HeLLo'.

The multiline flag (m) changes how ^ and $ work. Without m, ^ matches only the start of the entire string. With m, ^ matches the start of each line. This matters when your test string has multiple lines.

  • g — global: find all matches, not just the first
  • i — case-insensitive: ignore letter case
  • m — multiline: ^ and $ match line starts/ends
  • s — dotAll: . matches newlines too
  • u — unicode: enable full Unicode support

Building and debugging patterns step by step

Start with the simplest version of the pattern that matches the obvious cases. Don't try to write the final pattern in one go.

Add test strings for both the cases that should match and the cases that shouldn't. A good test set includes edge cases — empty strings, very long inputs, strings that are almost but not quite valid.

When a pattern matches too much or too little, use the tester to isolate which part of the pattern is responsible. Remove components one at a time until you find the problem.

The Irreva Regex Tester supports JavaScript regex syntax including named capture groups, lookaheads, lookbehinds, and Unicode property escapes. The test results update in real time as you type.

Frequently Asked Questions

Which regex flavor does the tester use?

The Irreva Regex Tester uses JavaScript's built-in regex engine, which is ECMAScript regex. This is compatible with TypeScript, Node.js, and browser JavaScript. For Python, Java, or .NET regex, the core syntax is mostly the same but some advanced features differ.

What does 'catastrophic backtracking' mean?

Some regex patterns can take exponential time to evaluate against certain inputs, effectively hanging the application. This is caused by nested quantifiers like (a+)+ applied to a string that doesn't match. In a tester, the pattern appears to freeze. Use atomic groups or possessive quantifiers to prevent it. In the Irreva tester, a timeout prevents this from hanging your browser.

Can I test regex for languages other than JavaScript?

The Irreva tester uses JavaScript regex. For Python's re module or Java's java.util.regex, the syntax is mostly compatible for common patterns. Differences appear with advanced features like lookbehind limits, possessive quantifiers, and Unicode handling. Test in the actual language environment when specifics matter.

What are named capture groups and why are they useful?

Named capture groups use the syntax (?<name>pattern). They let you reference matched groups by name rather than by index, making code more readable and less fragile if the pattern changes. In JavaScript: const { year, month } = '2026-03-15'.match(/(?<year>\d{4})-(?<month>\d{2})/)?.groups;

How do I match a string that does NOT contain a pattern?

Use a negative lookahead: ^(?!.*pattern).*$ matches strings that don't contain 'pattern'. Alternatively, use the programming language's string methods to filter results after matching — not everything needs to be done in a single regex.

Hasanur Rahman

About the author

Hasanur Rahman

Founder & Full-Stack Developer · Irreva · Rangpur, Bangladesh

Hasanur Rahman is the founder of Irreva and a full-stack developer based in Rangpur, Bangladesh. He builds all of Irreva's tools with a focus on privacy-first, browser-based processing.