Verify that the variable is defined before we try and run a regex on it.