Fix string testing

Move away from a switch to a regular expression