Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Flags

FlagMeaning
gGlobal — find all matches, not just first
iCase-insensitive
mMultiline — ^/$ match line boundaries
sDotall — . matches newline too
uUnicode — proper Unicode matching
vUnicode sets (ES2024) — set operations in character classes
dIndices — capture group positions in result
ySticky — match from lastIndex only

The Unicode Recommendation

Always use the u or v flag for new code. Without it, regex treats surrogate pairs as two characters — the same Unicode issue from Chapter 11 (strings). The v flag (ES2024) is the modern replacement for u, adding set operations within character classes.

(bind emoji (regex "\\p{Emoji}" "gu"))  ;; Unicode property escape