I want to find all matches within a given string including overlapping matches. How could I achieve it?
# Example
"a-b-c-d".???(/\w-\w/) # => ["a-b", "b-c", "c-d"] expected
# Solution without overlapped results
"a-b-c-d".scan(/\w-\w/) # => ["a-b", "c-d"], but "b-c" is missing
"abaca".scan(/(?=(\w)(?:(?!\1)(\w))\1)/) #=> [["a", "b"], ["a", "c"]]
. – Mil