Build, test, and debug regular expressions
Matches runs of one or more whitespace characters (spaces, tabs, newlines), capturing the final whitespace character in group 1. Typically used with a global replace to collapse consecutive whitespace—such as double spaces—into a single space. Common for cleaning and normalizing spacing in user input, logs, or document text. Note that \s matches any whitespace, not just literal spaces.