How to extract all the numbers from a string using regex in JavaScript

1 Answer

0 votes
var s = "javascript01223c++3php500--9_8";

document.write(s.match(/[0-9]+/g)); 
 
 
 
  
/*
run:
   
01223,3,500,9,8 
      
*/

 



answered Aug 3, 2019 by avibootz
...