character." has_error = false key_values.each do |key_value| key = key_value.keys.first value = key_value.values.first # 正規表現で愚直にチェック has_single_percent = value.match(/(?<!%)%(?![%]|[@]|[d]|[s]|[f]|[[0-9]$@]|[[0-9]$d]|[[0-9]$s]|[[0-9]$f])/) if has_single_percent has_error = true puts " key[#{key}] 's value have only '%' character." end end !has_error end