Alexey Petrushin wrote in post #991484:
> Probably a stupid question, but is there a way to use :gsub replacement
> without $0 $1 $2 $3 (and without "\0\1\2\3")?

Where are you replacing anything?

> I would prefer something like:
>
>     "John Smith".gsub /(.+)\s(.+)/ do |name, family|
>       p [name, family]
>
>       # instead of this
>       p [$1, $2]
>     end


"John Smith".scan(/\S+/) do |match|
  puts match
end

--output:--
John
Smith

-- 
Posted via http://www.ruby-forum.com/.