Regex Flags Tester

Enter a regex pattern and sample text to instantly see matches for every combination of i, g, m, and s flags side by side.

i = case-insensitive g = global (all matches) m = multiline (^ $ per line) s = dotAll (. matches newline)
Enter a pattern above to see results.

Summary

Enter a regex pattern and sample text to instantly see matches for every combination of i, g, m, and s flags side by side.

How it works

  1. Enter your regex pattern in the pattern field (without slashes or flags).
  2. Paste or type the test string you want to match against.
  3. The tool evaluates your pattern against all 16 flag combinations automatically.
  4. Each card shows the active flags, the number of matches, and the matched substrings highlighted.
  5. Cards with at least one match are highlighted so you can spot them instantly.

Use cases

  • Understand how the i flag affects case-sensitive patterns.
  • Debug multiline patterns by comparing m flag on and off.
  • Check whether dotAll (s) is needed to match newlines with a dot.
  • Verify global (g) flag behavior versus single-match mode.
  • Quickly find the minimal set of flags needed for your use case.
  • Teach regex flag concepts visually in a classroom or code review.
  • Audit third-party patterns before integrating them into production code.
  • Confirm that your pattern does not over-match with certain flag combinations.

Frequently Asked Questions

Last updated: 2026-06-09 · Reviewed by Nham Vu