Character Classes & Shorthand Sequences
Character classes define specific sets of characters to match. Shorthand sequences streamline pattern writing: \w matches any alphanumeric word character (A-Z, a-z, 0-9, _), \s matches any whitespace character (spaces, tabs, newlines), and \d targets numeric digits. Capitalizing shorthand characters (e.g., \W, \S, \D) inverts the match, targeting everything except that specified set.