in reply to Simple or not

I do have problems with the last \s since I need my \n

Maybe you could explicitly match spaces in the replacement (instead of whitespace). Or chomp off the newline first and then append it back on when you're done with the whitespace -> tab substition.  If I understood the problem correctly, that is...