How to extract whole number from a string using javascript

August 24, 2012

You’ll surely get your desired Output.

<script language=”javascript”>

var txt = “GUJ 12.50 VAT”;
var numb = txt.match(/\d+./g);
numb = numb.join(“”);
alert(numb);

//You’ll get 12.50 in numb….
</script>