I am trying to search for the numbers within a string, when I do so it only returns the last number of that string.
var exp = string.match('\:\d*[0-9]\,');
What I try to do is search for the numbers that go after the character : and before , but it doesn't work for me
var string = 'Caja_cebolla X100 :1.5, Caja_tomate :2, Caja_cebollin :0.25'; // Busco que me tome los números que estan delante de : y antes de ,
var exp = string.match('\:\d*[0-9]\,');
console.log(exp);
Basically I'm looking for the numbers after : and before ,. Example:
In Caja_cebolla X100 that I take the number 1.5
I hope it works for you!