# File lib/html/selector.rb, line 684
684:     def attribute_match(equality, value)
685:       regexp = value.is_a?(Regexp) ? value : Regexp.escape(value.to_s)
686:       case equality
687:         when "=" then
688:           # Match the attribute value in full
689:           Regexp.new("^#{regexp}$")
690:         when "~=" then
691:           # Match a space-separated word within the attribute value
692:           Regexp.new("(^|\s)#{regexp}($|\s)")
693:         when "^="
694:           # Match the beginning of the attribute value
695:           Regexp.new("^#{regexp}")
696:         when "$="
697:           # Match the end of the attribute value
698:           Regexp.new("#{regexp}$")
699:         when "*="
700:           # Match substring of the attribute value
701:           regexp.is_a?(Regexp) ? regexp : Regexp.new(regexp)
702:         when "|=" then
703:           # Match the first space-separated item of the attribute value
704:           Regexp.new("^#{regexp}($|\s)")
705:         else
706:           raise InvalidSelectorError, "Invalid operation/value" unless value.empty?
707:           # Match all attributes values (existence check)
708:           //
709:       end
710:     end