验证和匹配字符串