Check argument is a string before calling string-match