# File lib/mail/encodings.rb, line 115
    def Encodings.value_decode(str)
      # Optimization: If there's no encoded-words in the string, just return it
      return str unless str =~ /\=\?[^?]+\?[QB]\?[^?]+?\?\=/xmi

      lines = collapse_adjacent_encodings(str)

      # Split on white-space boundaries with capture, so we capture the white-space as well
      lines.map do |line|
        line.split(/([ \t])/).map do |text|
          if text.index('=?').nil?
            text
          else
            # Search for occurences of quoted strings or plain strings
            text.scan(/(                                 # Group around entire regex to include it in matches
                        \=\?[^?]+\?([QB])\?[^?]+?\?\=    # Quoted String with subgroup for encoding method
                        |                                # or
                        .+?(?=\=\?|$)                    # Plain String
                      )/xmi).map do |matches|
              string, method = *matches
              if    method == 'b' || method == 'B'
                b_value_decode(string)
              elsif method == 'q' || method == 'Q'
                q_value_decode(string)
              else
                string
              end
            end
          end
        end
      end.flatten.join("")
    end