Shanmuga Kumar Shanmuga Kumar - 1 year ago 52
Javascript Question

How to remove the character form string using jQuery?

How to remove character from strings (a-z, A to Z) using jQuery or JavaScript?

if str=avc234jw6;


I need only 2346.

Answer Source

A simple String.replace with regex /[a-z]/ig can do!

var str = "avc234jw6";
var no = parseInt(str.replace(/[a-z]/ig, ""));

console.log(no);