#500 · Developer Tool

Regex Flags Explainer

Explain JavaScript regular-expression flags and check whether a flag combination is valid in the current browser. The report covers matching behavior, interactions such as Unicode sets versus Unicode mode, stateful global and sticky searches, and newer flags that may not be supported everywhere. An optional pattern compile test exposes compatibility problems immediately.

Developer Input

Regex Flags Explainer
Ad space

How to use this developer tool

  1. Enter flag letters without slashes or a pattern.
  2. Optionally provide a pattern and enable compilation testing.
  3. Run the explanation to identify duplicates, invalid letters, and interactions.
  4. Use the compatibility result for the browser currently running the page.

What this developer tool does

The report gives one practical explanation per supplied flag, then lists combination warnings and compilation status.

Validate letters against JavaScript flags, detect duplicates and incompatible u/v use, then construct a RegExp when compilation testing is enabled.

A successful compile result applies to the current browser, not every JavaScript runtime.

Example

Input: gim
Meaning: global iteration, case-insensitive matching, multiline anchors

Use cases

  • Review copied regex literals.
  • Choose between s and multiline behavior.
  • Check support for indices and Unicode sets.

Tips for reliable output

  • Do not include slash delimiters.
  • Remember g and y make lastIndex stateful.
  • Use m for anchors, not dot matching.
  • Use s when dot should include line terminators.

Processing details

Supported letters are d, g, i, m, s, u, v, and y. Duplicate flags and the mutually exclusive u/v combination are rejected by JavaScript.

Flag availability changes across runtimes. Compile testing reflects only the active browser engine.

Frequently asked questions

Which regular expression syntax is supported?

Patterns use the JavaScript regular expression engine available in your browser.

What happens when the pattern is invalid?

The tool reports the JavaScript syntax error and does not process the input text.

Can a regular expression freeze the page?

Pathological patterns can cause catastrophic backtracking. Test untrusted patterns on small input first.

Are matches evaluated by Unicode code point?

Only when the Unicode-related flag and pattern semantics call for it; otherwise JavaScript uses UTF-16 code units.

Does the tool send pattern or text to a server?

No. Matching and replacement run in the current browser tab.

Output fields

FieldMeaning
SummaryHigh-level processing result
StatisticsCounts and validation details
ExportCopy-ready text plus structured data when available

Code Formatting & Regex tools

Browse more tools for code formatting & regex.

Open category hub