Hi,
In message "[ruby-talk:02024] Re: Ruby Syntax similar to other languages?"
on 00/03/19, ts <decoux / moulon.inra.fr> writes:
|> If 'g' was an attribute of Regexp, then what would
|>
|> line =~ /asdf/g
|>
|> mean?
|
| while line =~ /asdf/g
| print "#$&\n"
| end
|
|it's more perl than ruby, sorry
Adding 'g' as a Rexexp option makes me feel like Perl. We have
String#scan for this particular purpose.
line.scan(/asdf/) do
print "#$&\n"
end