Forum: Ruby regex loop yields single element array for multiple finds:

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
19a9e4d07410618284db6a44de12e079?d=identicon&s=25 Xeno Campanoli (Guest)
on 2006-04-28 20:15
(Received via mailing list)
Okay, my string has a parenthesized section, and that is doing it:

markup.scan(/@@@.*?(@@@).*?@@@/) do |ats|
puts ats.length
puts ats.class
end

is a closer to what I've got.  My apologies.  So, it looks like whenever
you specifiy
a section with parameters you then get an array.  I guess that makes
sense.  Thanks.

xc
This topic is locked and can not be replied to.