>>487
str = "AAA\nBBB\nCCC"
str.scan(/(^.*(?:\n|\z))/) do
 p $1
end