On this page
  1. String, RegExp & Intl
  2. Contents
  3. Strings & Template Literals
  4. Regular Expressions (RegExp)
  5. Internationalization (Intl)

String, RegExp & Intl

Prev: Proxy & Well-Known Symbols | Up: builtins | Next: JSON, Math, BigInt & Date
Rel: Core Syntax & Types
Ref: MDN Web Docs — Intl
Tags: #public #web #javascript #builtins


Contents


Strings & Template Literals

JavaScript strings are immutable UTF-16 sequences. Iterate Unicode code points cleanly with for...of or [...str], and use tagged template literals for safe escaping or DSLs.

const name = "Ada";
const msg = `Hello, ${name.toUpperCase()}!`;

Regular Expressions (RegExp)

Use the u (or v) flag for Unicode-safe matching and named capture groups (?<name>...):

const re = /(?<year>\d{4})-(?<month>\d{2})-(?<day>\d{2})/u;
const { year, month, day } = "2026-11-23".match(re).groups;

Internationalization (Intl)

Intl formats dates, currencies, relative times, lists, and plurals natively without external libraries:

const usd = new Intl.NumberFormat("en-US", { style: "currency", currency: "USD" });
console.log(usd.format(1299.5)); // "$1,299.50"

const dateFmt = new Intl.DateTimeFormat("en-US", { dateStyle: "medium" });
console.log(dateFmt.format(new Date("2026-11-23T12:00:00Z")));

Linked from

Related notes