Ya, in this case (HTML/XML), Hpricot is your best bet.

Otherwise, standard regex stuff would apply, imo.

On Mon, Sep 22, 2008 at 12:44 PM, Li Chen <chen_li3 / yahoo.com> wrote:
> 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/.
>
>



-- 
todb / planb-security.net | ICQ: 335082155 | Note: Due to Google's
privacy policy <http://tinyurl.com/5xbtl> and the United States'
policy on electronic surveillance <http://tinyurl.com/muuyl>,
please do not IM/e-mail me anything you wish to remain secret.