regex extract number from string javascript code example
Example 1: get only numbers regex javascript
var numberPattern = /\d+/g;
'something102asdfkj1948948'.match( numberPattern )
Example 2: jquery extract number from string
var id_of_div = "div_id_12";
var id_number = parseInt(id_of_div.replace(/[^0-9.]/g, ""));
console.log(id_number);//12