javascript - How to get float value from string using regex? -
i have string value this:
"zar 200.15"
using regex, how can extract float value calculations with?
for context, i'm using javascript access html element's value this:
var amountduestring = document.getelementbyid("amountdue").innerhtml;
then need use regex float value.
var amountdue = amountduestring.match(---some regex---);
i want extract float value in order compare user input.
try this:
(\d)+\.(\d+)
tested on notepad++
Comments
Post a Comment