Regex Flags
A complete reference of every flag supported by JavaScript's RegExp object, sorted alphabetically by character. Each record includes the single-character flag, the corresponding RegExp property name (e.g. global, ignoreCase), and a precise plain-language description of its effect on matching behavior.
Quick fetch
Stable URL. CORS-enabled. No auth.
curl https://staticdata.dev/v1/regex-flags.json
Or use as a typed import:
import { regexFlags } from "https://staticdata.dev/v1/regex-flags.ts"
Formats
- JSON 1.9 KB
/v1/regex-flags.json
min: 1.7 KB · /v1/regex-flags.min.json
- CSV 1.4 KB
/v1/regex-flags.csv
- TypeScript 2.1 KB
/v1/regex-flags.ts
export const regexFlags
type RegexFlag = (typeof regexFlags)[number]
Schema
Each record in the dataset has the following shape.
| Field | Type | Description | Example |
|---|---|---|---|
| flag | string | Single character that activates the flag in a regex literal or RegExp constructor | g |
| name | string | Corresponding boolean property name on the RegExp instance | global |
| description | string | Plain-language explanation of what the flag does | Find all matches rather than stopping after the first match. |
Preview
First 8 records.
| flag | name | description |
|---|---|---|
| d | hasIndices | Generate indices for substring matches — adds a .indices array to each match result with start/end positions for the match and each capture group. |
| g | global | Find all matches rather than stopping after the first match. exec() and test() advance lastIndex after each match; match() and replace() return or replace every match. |
| i | ignoreCase | Perform case-insensitive matching. Letters in the pattern match both upper- and lower-case variants in the input string. |
| m | multiline | Treat ^ and $ as matching at the start and end of each line (lines are separated by the line terminators \n, \r, \u2028 or \u2029) rather than only at the start and end of the entire string. |
| s | dotAll | Allow the . metacharacter to match any character including newline characters (\n, \r, \u2028, \u2029). Without this flag, . does not match line terminators. |
| u | unicode | Enable full Unicode mode. Treats the pattern and string as sequences of Unicode code points, enables Unicode escapes (\u{...}), and applies Unicode case folding for case-insensitive matching. |
| v | unicodeSets | Enable Unicode sets mode (supersedes u). Adds set notation and string properties in character classes ([...]), intersection ([A&&B]), subtraction ([A--B]), and improved Unicode handling. Cannot be combined with u. |
| y | sticky | Match only at the exact position indicated by lastIndex — do not advance through the string searching for a match. Effectively anchors the match at lastIndex. |
Fetch examples
Drop-in snippets in five languages.
curl -sSL https://staticdata.dev/v1/regex-flags.json | jq '.[0]' import type { RegexFlag } from "https://staticdata.dev/v1/regex-flags.ts";
const res = await fetch("https://staticdata.dev/v1/regex-flags.min.json");
if (!res.ok) throw new Error(`Fetch failed: ${res.status}`);
const regexFlags: RegexFlag[] = await res.json();
console.log(regexFlags[0]); import urllib.request, json
with urllib.request.urlopen("https://staticdata.dev/v1/regex-flags.min.json") as r:
regexFlags = json.load(r)
print(regexFlags[0]) package main
import (
"encoding/json"
"fmt"
"net/http"
)
func main() {
resp, err := http.Get("https://staticdata.dev/v1/regex-flags.min.json")
if err != nil { panic(err) }
defer resp.Body.Close()
var data []map[string]any
if err := json.NewDecoder(resp.Body).Decode(&data); err != nil {
panic(err)
}
fmt.Println(data[0])
} use serde_json::Value;
fn main() -> Result<(), Box<dyn std::error::Error>> {
let body = ureq::get("https://staticdata.dev/v1/regex-flags.min.json").call()?.into_string()?;
let data: Vec<Value> = serde_json::from_str(&body)?;
println!("{:?}", data.first());
Ok(())
} Sources and methodology
JavaScript’s RegExp object supports eight flags that modify how a pattern is applied to a string. Flags can be combined freely — with the single exception that u (unicode) and v (unicodeSets) are mutually exclusive. In a regex literal they are appended after the closing slash (e.g. /foo/gi); in the RegExp constructor they are passed as the second argument (e.g. new RegExp('foo', 'gi')).
This dataset is curated from the ECMAScript specification and MDN documentation. The v flag (unicodeSets) was introduced in ES2024 and supersedes u for new code requiring advanced Unicode character-class features. The d flag (hasIndices) was introduced in ES2022. All other flags have been available since ES3 (g, i, m) or ES2015 (u, y) and ES2018 (s). As of ES2026 (October 2026) no further flags have been added.
All flag characters are ASCII lowercase letters. The flags property of a RegExp instance returns a string containing the active flag characters in a fixed canonical order: dgimsuvy.
Versioning
URLs under /v1/ are stable: field names and types will not change in a way
that breaks consumers. Values can be corrected or records added when the upstream source
changes; schema-incompatible updates ship under a new version path. See the
regex-flags changelog for this dataset's history.
Related datasets
More Code datasets
- cron-presets
- css-at-rules
- css-functions
- css-named-colors
- css-properties
- css-pseudo-classes
- css-pseudo-elements
- css-units
- data-units
- exit-codes
- file-signatures
- hash-algorithms
- js-array-methods
- js-math-methods
- js-object-methods
- js-string-methods
- json-schema-keywords
- jwt-claims
- mathematical-constants
- measurement-units
- node-builtin-modules
- owasp-top-10
- periodic-table
- physical-constants
- posix-signals
- programming-languages
- regex-patterns
- roman-numerals
- si-base-units
- si-derived-units
- si-prefixes
- spdx-licenses
- strftime-tokens
- tailwind-colors
- time-units
- unicode-blocks
- unicode-general-categories
- unicode-planes
- unix-file-permissions
- xterm-256-colors