Test, validate and match regular expressions
Matches leading blank characters (spaces/tabs) at the start of a line, trailing blanks at the end of a line, or any run of two or more consecutive blanks (capturing the first one in group 2). With the global and multiline flags, it applies to every line of the text. Commonly used in find-and-replace to strip indentation and trailing whitespace (replace with empty string) or to collapse internal blank runs into a single space (replace with $2).