The difference between \s and \S is that the former matches all the whitespace while the latter matches all nonwhitespace. The addition of + says to the regex engine - “I want 1 or more of the previous symbol” Matches involving + are said to be greedy and take as many characters as they can in a given match. so \s+ says match if there’s one or more whitespace in a row, making the longest match y..