From: Peter Hickman Date: 2012-08-16T04:30:10+09:00 Subject: Re: string processing You need to also make sure that you get the right line, not just pick out the any digits DATA.each do |line| if line =~ /^Success - new device-id: \((\d+)\)/ puts $1 end end __END__ uk-xxxxxxx-Z15A14 Adding uk-xxxxx-Z15A14 (uk-xxxx-Z15A14) as "Generic SNMP-enabled Host" using SNMP v1 with community "public" Success - new device-id: (26) The $1 is the captured value, the (\d+) part. On 15 August 2012 20:18, Fosiul Alam wrote: > sorry the code i wrote that does not do anything > > syntax help would be really appreciate > > -- > Posted via http://www.ruby-forum.com/. >