Is there a way to extract percentage values from a string without including the percent sign?
I am trying to retrieve the numbers from the string, excluding the % symbol. Currently, my code works but includes the percent sign in the output:
"asfd %1.3344 %1.2323 % asdf %".match(/%[0-9.]*/g)
Result:
["%1.3344", "%1.2323", "%", "%" ]
But I want the result to be [ 1.3344, 1.2323]
I attempted using a regex look ahead, but it didn't work as expected and returned an array of empty strings:
"asfd %1.3344 %1.2323 % asdf %".match(/(?=%)[0-9.]*/g)
result: ["", "", "", "" ]