in javascript i am using split method by regular expression for below string, but it does not work fine in javascript code, also i tested it on some online regex tester website like RegExr and it works fine!
the string: "$1 $2 $3 $5 $7 hello".
the result : ["","$7 ","hello"]
Expected result : ["hello"]
here is my codes: online example!
function myFunction() {
    var str = "$1 $2 $3 $5 $7 hello";
    var res = str.split(/([$][0-9]+[ ]*)+/gu);
    document.getElementById("demo").innerHTML = res;
}<p>Click the button to display the array value after the split.</p>
<button onclick="myFunction()">Try it</button>
<p id="demo"></p>how can i fix it?
 
     
     
    