A handy function for validating strings and replacing unwanted contents, by searching for matches with regular expression patterns. There are two functions - one that replaces pattern matches, and one that can call the first function multiple times, each time with a different pattern.