From: "Jesús Gabriel y Galán" Date: 2011-04-16T07:03:41+09:00 Subject: Re: Extract a range i.e. svr[100..130] ? On Fri, Apr 15, 2011 at 11:54 PM, Richard Sandoval wrote: > Here is what i am trying to do. > > > > nodes = cfv.values.to_s.split(/[, \n]+/) split returns an array (http://ruby-doc.org/core-1.8.7/classes/String.html#M000776). So you can do the following: nodes.each do |node| m = node.match(/(.*?)\[(\d+)\.\.(\d+)\](.*)/) if m (m[2].to_i..m[3].to_i).each {|num| do_something_with("#{m[1]}#{num}#{m[4]}")} else do_something_with(node) end end This will call do_something_with passing either each expanded server name or the original string if it doesn't match the regular expression. Jesus.