Reputation: 13
i need to get number with sign from a string.
eg:
-675.5+987.5i
+675.5-987.5i
output:
-675.5
+987.5
+675.5
-987.5
Upvotes: 0
Views: 109
Reputation: 152206
var numbers = "-675-987i".match(/[-+]\d+(\.\d+)?/g);
Edited to handle also plus sing and float value.
Upvotes: 3