# File lib/uri_template/rfc6570/expression.rb, line 217
    def decode(x, split = true)
      if x.nil?
        return extracted_nil
      elsif split
        result = []
        # Add a comma if the last character is a comma
        # seems weird but is more compatible than changing
        # the regex.
        x += COMMA if x[-1..-1] == COMMA
        URITemplate::RegexpEnumerator.new(SPLITTER, :rest => :raise).each(x) do |match|
          if match[1]
            next if match[1].size == 1
            result << match[1][0..-3]
          elsif match[2]
            result << unescape(match[2])
          end
        end
        case(result.size)
          when 0 then ''
          when 1 then result.first
          else result
        end
      else
        unescape(x)
      end
    end