Looking to split a string into an array based on type, extracting numbers and floats. The current code is able to extract some values but not complete.
var arr = "this is a string 5.86 x10‘9/l 1.90 7.00"
.match(/\d+\.\d+|\d+\b|\d+(?=\w)/g)
.map(function (v) {return v;});
console.log(arr);
arr = [5.86, 10, 9, 1.9, 7]
Desiring an even mix of string type chunks like "x10‘9/l" in the array:
arr = ["this is a string", 5.86, "x10‘9/l", 1.9, 7]
Any ideas on how to achieve this?