only calling gsub on string values
removing unnecessary guards
extracted regexes to constants
merged with testing
Merge pull request #463 from shatterednirvana/sanitizing-only-strings

only calling gsub on string values