I am trying to create an array with the matched elements from a string. I am not having much success (the result is an empty array). Here is what I got:
What am I doing wrong?
Code:
var regpattern = new RegExp("^\d+(\.\d{1,2})?$");
var myarray = new Array;
myarray[21] = "TEXT NOT NEEDED";
myarray[22] = "Diagnosis: Other cardiorespiratory problems-V47.2; OTHER - RHEUMATIC FEVER W/O";
myarray[23] = "HEART INVOLV - 390; Paroxysmal supraventricular tachycardia-427.0; Partial";
myarray[24] = "congenital anomalous pulmonary venous"
myarray[25] = "MORE TEXT NOT NEEDED";
var mystring = myarray.slice(22,25," "); // This works
var stringarray = regpattern.exec(mystring);
What am I doing wrong?