From: Robert Klemme Date: 2012-10-03T06:03:59+09:00 Subject: Re: sparse xml string On Mon, Oct 1, 2012 at 11:32 PM, ajay paswan wrote: > How to sparse a string like: > > suppose input is str="1223" > I want str_a=["1","22","3"] > How can I get str_a from str? I'd use a proper XML or HTML processing tool for that. Then you can search with XPath '//a'. $ irb19 -r nokogiri irb(main):001:0> str = "1223" => "1223" irb(main):004:0> dom = Nokogiri.HTML str => #, #]>, #]>, #]>]>]>]> irb(main):005:0> str_a = dom.xpath '//a' => [#]>, #]>, #]>] irb(main):006:0> str_a.size => 3 Kind regards robert5 -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/