in reply to regex doubt on excluding

The 'standard' way to construct a character class that excludes characters is  [^...].

One way to define the class of all whitespace except a newline would be  [^\S\n]. (Note this the big-S  \S which is the inverse of  \s i.e.,  \S matches any character that is not whitespace.) So this is a kind of double-negative. You might read it as "the class of all characters that are not non-whitespace and also not a newline."