`+` operator within a regex seems to be more than just the greedy operator

229 views Asked by At

I was doing some random Ruby reading, and had been messing around with different things in Ruby that does behind the scenes implicit conversions to an array. So within my pry console I had done this:

[1] pry(main)> class String
[1] pry(main)*   def to_ary
[1] pry(main)*     [100]
[1] pry(main)*   end
[1] pry(main)* end

Within the same pry session, if I do the following:

[14] pry(main)> /++/ === "whatever"
100

What is Ruby doing here?!

0

There are 0 answers