From: Tod Beardsley
Date: 2008-09-23T03:11:01+09:00
Subject: Re: how to extract something in between a pattern
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 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=aabbccccddee
>>
>> I wanna get the anything between and
, which is ccddee
>>
>>
>> Thanks in advance.
>
>
> C:\Users\Alex>irb
> irb(main):001:0> require 'hpricot'
> => true
> irb(main):002:0> a="aabbccccddee
"
> => "aabbccccddee
"
> irb(main):003:0>
> irb(main):004:0* doc=Hpricot(a)
> => # "ccddee"
}>
> 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 and the United States'
policy on electronic surveillance ,
please do not IM/e-mail me anything you wish to remain secret.