Cheyne Li wrote:
> Hi experts,
> 
> I'm not very familiar with ruby's library. I wonder if there a method
> can extract something in a pattern? For example,
> 
> I have a string: a=aabbcc<p>ccddee</p>
> 
> I wanna get the anything between <p> and </p>, which is ccddee
> 
> 
> Thanks in advance.


C:\Users\Alex>irb
irb(main):001:0> require 'hpricot'
=> true
irb(main):002:0> a="aabbcc<p>ccddee</p>"
=> "aabbcc<p>ccddee</p>"
irb(main):003:0>
irb(main):004:0* doc=Hpricot(a)
=> #<Hpricot::Doc "aabbcc" {elem <p> "ccddee" </p>}>
irb(main):005:0> p doc.at('p').inner_text
"ccddee"
=> nil
irb(main):006:0>



Li
-- 
Posted via http://www.ruby-forum.com/.