Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

js extract only numbers from string

"1.23-45/6$7.8,9".replace(/[^0-9]/g,'')

// Response: "123456789"
Comment

Extract number from string javascripy

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
Comment

extract numbers from a string javascript

const extractNumbers = (string) => {
  const regex = /[0-9/ /]/g;
  const nums = string.match(regex);
  const newText = nums.join("");
  
  return newText
};
Comment

javascript extract number from string


// Html: <span id="foo">280ms</span>

var text = $('#foo').text();
var number = parseInt(text, 10);
alert(number);

// parseInt('ms120'.replace(/[^0-9.]/g, ''), 10);
Comment

PREVIOUS NEXT
Code Example
Javascript :: immediately invoked function in javascript 
Javascript :: jQuert latest cdn 
Javascript :: how to display items quantity into select input field 
Javascript :: how to reverse an array in javascript 
Javascript :: google maps init map 
Javascript :: javascript camera 
Javascript :: how to create react native project at specific version 
Javascript :: prodigy math game add item by id 
Javascript :: js array sort 
Javascript :: Get day first 3 letters name js 
Javascript :: import json file python online 
Javascript :: print json pretty linux 
Javascript :: digit count in javascript 
Javascript :: converting json to javascript object 
Javascript :: datatable column width 
Javascript :: random id number nodejs 
Javascript :: javascript multiples of 3 and 5 
Javascript :: how to detect account change in metamask 
Javascript :: create textbox using javascript 
Javascript :: get the value of css properties js 
Javascript :: dynamically adding marker react native mapbox 
Javascript :: javascript html encode 
Javascript :: jQuery select elements by name 
Javascript :: how to make a modal stay center of screen 
Javascript :: jquery validator no space 
Javascript :: canvas umu 
Javascript :: return random rows sqlite 
Javascript :: drawer navigation set width react native 
Javascript :: get youtube id from url javascript 
Javascript :: beautify json in html 
ADD CONTENT
Topic
Content
Source link
Name
5+2 =