Javascript examples for RegExp:Match Number
Create Decimal regular expression with zero using regex
<html> <head></head> <body> <script> var str = 'abc0.06abc'; var newstr = str.replace(/[^0-9.()]/g, ''); if (/^\d*(\.\d+)*$/.test(str) == false) { console.log(newstr + " is valid"); } else {//from w w w .j a v a 2 s .c o m console.log(newstr + " is not valid"); } </script> </body> </html>