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 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

PREVIOUS NEXT
Code Example
Javascript :: how to start json server in particular port 
Javascript :: angular open poort in network 
Javascript :: python json save to file 
Javascript :: javascript get current url 
Javascript :: javascript code to edit webpage 
Javascript :: three js cdn 
Javascript :: jquery select checked radio button value 
Javascript :: chrome extension get current tab url 
Javascript :: jquery-3.2.1.min.js download 
Javascript :: jquery add checked attribute 
Javascript :: dynamics 365 javascript set disabled 
Javascript :: angular valuechanges get id 
Javascript :: loop through object jquery 
Javascript :: length of dict js 
Javascript :: dino game hack 
Javascript :: how to remove item from asyncstorage 
Javascript :: how to select the next element in js 
Javascript :: generate random character in javascript 
Javascript :: check if checkbox is checked jquery 
Javascript :: gitignore all node_modules 
Javascript :: node console log without newline 
Javascript :: is advanced functions harder than calculus 
Javascript :: hr react 
Javascript :: regex get number inside parentheses 
Javascript :: how to extract domain name of url of current page in javascript 
Javascript :: get height element use js 
Javascript :: js scroll to bottom 
Javascript :: object to url params js 
Javascript :: in array jquery 
Javascript :: javascript code for year in html 
ADD CONTENT
Topic
Content
Source link
Name
4+3 =