I can't figure out a way to get all possible matches. For the most basic example I have this:
"bbb".match(/bb/g);
//returns ["bb"]
but I would like it to return ["bb","bb"]
because bb
matches with the first two b's and then again with the last 2 b's
In this example the possible matches are identical but they don't have to be for example :
"abab".match(/(.{1}).{1}\1/g);
//returns ["aba"]
Again here I was hoping for ["aba","bab"]
Is there a way to do that?