function justNumbers(string) { var numsStr = string.replace(/[^0-9]/g, ''); return parseInt(numsStr); } var input = "Rs. 6,67,000"; var number = justNumbers(input); console.log(number); // 667000 Run code snippet