A function using gsub to make different actions on a string