From: Ruby Newbee Date: 2010-01-04T16:53:15+09:00 Subject: how to capture all conditions using regex Hello, irb(main):001:0> x="123 456 789" => "123 456 789" irb(main):003:0> if /\d{3}/ =~ x irb(main):004:1> puts $& irb(main):005:1> end 123 For the statement above, I want to capture all "123" and "456" and "789", not the only "123". How to do it (must use regex)? Thanks.