From: "Jan E." Date: 2012-07-17T11:10:24+09:00 Subject: Re: extracting part of a string Hi, You can use a regular expression to extract the server names: text = 'server.corp.abc.com:/vol/test/xyz server2.corp.def.com:/vol/stage/123 server3.corp.xyz.net:/vol/prod/abc' servers = text.scan /^\s*([^:\s]+)/ p servers This looks for the beginning of a line followed by whitespace followed by characters, which are neither colons nor whitespace. The latter part is then saved. If you don't like the strings being in subarrays, you can append "map &:first". -- Posted via http://www.ruby-forum.com/.