Skip to main content
REGULAR-EXPRESSIONS5 MIN READ

Sort regex flags by the behavior they change

Identify which regex flag changes which matching behavior before debugging a surprising result.

Place each flag or mode change into the behavior bucket it primarily affects. Case comparison Line anchors Dot behavior Unicode handling Iteration state i flag lets PRO match pro Inline case-insensitive mode for part of a pattern m flag makes ^ and $ work per line A whole-string validator accidentally accepts one matching line s flag lets . match newline characters A section matcher crosses paragraphs after dotall is enabled Unicode mode treats the pattern as code points in JavaScript Unicode set behavior changes character-class meaning Global matching advances lastIndex across exec calls Sticky matching requires a match at the…

Read the full lesson

Sign up free — one personalized lesson every day, matched to your role and goals.

Already have an account? Sign in

← Back to library
Contact us