here is my requirement
const input = 'abcadbca';
const required = 'bca';
the input contains 3 possibility anagrams as:abc
,bca
,bca
;
is this all can be selected using regexp
?
i tried it, but got not result:
const str = 'abcadbca';
const reg = str.match(/(a|b|c)/g);
console.log(reg);
result expectation: [a,b,c,][b,c,a],[b,c,a]
;
result should be [a,b,c],[b,c,a]
- first 2 match are overlapping so first match is taken for the account.