Only try a regex search if the given parameter is a string