Use lstrip instead of gsub to only remove leading whitespace.