Take this example:
"12345".match(/(?=(\d{4}))/g);
Pasting that line above into my (Chrome) console is returning ["", ""]
for me but I am trying to extract an array of ["1234", "2345"]
. This MDN article seems to indicate that I should, indeed, expect an array of matches.
The particular regex on this exact string definitely returns those matches as proven in this question from yesterday.
Can anyone please clarify what the expected behavior should be and any alternative approaches I could take here if I have made an incorrect assumption about this function and/or am misusing it.