# Hpricot Help

**URL:** <https://www.ruby-forum.com/t/hpricot-help/66487>\
**Category:** Ruby\
**Created:** [August 26, 2006, 11:28am UTC](https://www.ruby-forum.com/t/hpricot-help/66487 "2006-08-26T11:28:16Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Chih-Chao\_Lam](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/ed655f/32.png) [@Chih-Chao\_Lam](https://www.ruby-forum.com/u/Chih-Chao_Lam)\
**Post date:** [August 26, 2006, 11:28am UTC](https://www.ruby-forum.com/t/hpricot-help/66487/1 "2006-08-26T11:28:16Z")

</div>

Hi,

I’m playing around with Hpricot was am wondering if I’m using it  
wrongly or have I encountered a bug.

Here’s an irb transcript that shows this:  
irb(main):001:0\> html = “\<div class=xyz’\>abc”  
=\> “\<div class=xyz’\>abc”  
irb(main):002:0\> require ‘rubygems’; require ‘hpricot’  
=\> true  
irb(main):003:0\> @doc = Hpricot(html)  
=\> #\<Hpricot::Doc {elem

 {text “abc”} 
}\>  
irb(main):004:0\> @doc.search(’.xyz’)  
NoMethodError: undefined method `[]=' for #<MatchData:0x71b058> from /usr/local/ror/lib/ruby/gems/1.8/gems/hpricot-0.4/lib/ hpricot/traverse.rb:110:in`search’  
from (irb):4

I’m trying to get all html elements of the class “xyz” (regardless of  
HTML Element tag type).

Looking at line#110 or traverse.rb, it looks like the code is trying  
to make an assignment to a MatchData pseudo-array. Is this allowed?

Thanks for any help here and thanks to \_why for a fantastic library,

Chao Lam
