upped version
protect regex matcher against non-string values