def attribute_value(string)

      attribute_value = ''
      position = 0
      length = string.length

      while position < length
      
        # x09 (ASCII TAB), 0x0A (ASCII LF), 0x0C (ASCII FF), 0x0D (ASCII CR), or 0x20 (ASCII space) then advance position to the next byte, then, repeat this step.
        if string[position] =~ /[\u{09}\u{0A}\u{0C}\u{0D}\u{20}]/
            
          position += 1

        elsif string[position] =~ /['"]/

          attribute_value, position = quoted_value(string[position, length])
          break

        elsif string[position] == '>'
          position += 1
          break

        else
          attribute_value, position = unquoted_value(string[position, length])
          break
        end
      end

      [attribute_value, position]
    end
def attribute_value(string)

      attribute_value = ''
      position = 0
      length = string.length

      while position < length
      
        # x09 (ASCII TAB), 0x0A (ASCII LF), 0x0C (ASCII FF), 0x0D (ASCII CR), or 0x20 (ASCII space) then advance position to the next byte, then, repeat this step.
        if string[position] =~ /[\u{09}\u{0A}\u{0C}\u{0D}\u{20}]/
            
          position += 1

        elsif string[position] =~ /['"]/

          attribute_value, position = quoted_value(string[position, length])
          break

        elsif string[position] == '>'
          position += 1
          break

        else
          attribute_value, position = unquoted_value(string[position, length])
          break
        end
      end

      [attribute_value, position]
    end
Given a string, this returns the attribute value from the start of the string,
 and the position of the following character in the string