Regex Flags Reference
Interactive reference for regex flags (g, i, m, s, u, y, d) with live behavior examples.
What is Regex Flags?
A comprehensive reference for JavaScript regex flags: g (global), i (case-insensitive), m (multiline), s (dotAll), u (unicode), y (sticky), d (indices). Each flag includes a live side-by-side comparison.
How it works
We display each flag's documentation, then run a shared test pattern against a sample string with and without the selected flag, highlighting the difference in matching behavior.
- Enter your input. Type or paste your input into the field above — the tool responds instantly.
- Review the result. Output updates live as you type. Everything runs entirely in your browser.
- Copy or download. Use the Copy button to grab the result, or Download to save it as a file.
Examples
Flag reference
Look up what each flag does — global (g), ignore-case (i), multiline (m), dot-all (s), sticky (y), and unicode (u).
Common mistakes
Flags are engine-specific
Some flags — like dot-all (s) and unicode (u) — aren't supported everywhere. Check the target engine's documentation.
Frequently asked questions
What does the 'u' flag do?
The unicode flag enables correct handling of surrogate pairs and Unicode property escapes (\p{...}). Without it, astral-plane characters like emoji are treated as two separate characters.