Reputation: 697
I need to parse a table with prices range, but I've got stuck because prices range is showing as text only, and there is no id's or classes to identify them. Text looks like the following thing:
11 702 500 - 16 000 000
760 550 - 890 000
145 000 200 - 185 000 100
Is it possible to use regex or something to return two values, first as first price and second as second price? I understand how I can remove spaces, but I have no idea how to divide both numbers and return them individually
JSFiddle: http://jsfiddle.net/tx4d439m/
Upvotes: 1
Views: 48
Reputation: 819
try this:
var x = '11 702 500 - 16 000 000';
x = x.replace(/\s/g,'').split('-');
console.log(x);
Upvotes: 1