Is it possible in JavaScript to find a nested match with an arbitrary regular expression (I found solutions only for spacial regex cases - not arbitrary)? For example, if I have the text "555666"
, and I try matching with the regex 5.*6
, I always get 1 match byt this code
let m = "555666".match(/5.*6/);
console.log(m)
but the desired output for me is get all matches
['56', '556', '5556', '566', '5666', ...]
Second example of regexp: a?.b|a.*c
input string "aaabbbcaccdddedeee"
and desired output
['ab', 'bb','aaabbbc',....]
I look for solution which works for arbitrary regexp - how I can do it in JS?