I'm trying to achieve:
'abc'.scan(regex) #=> ['a', 'b', 'c', 'ab', 'bc', 'abc']
It can be done like this:
(1..'abc'.size).map {|l| 'abc'.scan /(?=(\w{#{l}}))/}.flatten
#=> ["a", "b", "c", "ab", "bc", "abc"]
But I would like to do it in one regex expression.