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

Popular posts from this blog

sql - invalid in the select list because it is not contained in either an aggregate function -

Angularjs unit testing - ng-disabled not working when adding text to textarea -

How to start daemon on android by adb -