^ Caret matches the beginning of the line \s This matches any white space character
- This is quantity operator for \s it match zero or more $ Dollar sign matches end of the line \n and this one matches new line character
#1 Remove all new line without any character ##\n and space behind
\n