javascript check if string contains invalid characters