"12312u3jkaslsdlf;;;asdfasdf".replace(/[^0-9]/g, "");
출력 : 123123
"12312u3jkaslsdlf;;;asdfasdf".replace(/[0-9]/g, "");
출력 : ujkaslsdlf;;;asdfasdf
"12312u3jkaslsdlf;;;asdfasdf".replace(/[a-zA-Z]/g, "");
출력 : 123123;;;
"12312u3jkaslsdlf;;;asdfasdf".replace(/[^a-z]/g, "");
출력 : ujkaslsdlfasdfasdf
let str = "12j3k12j3lkajkdslfasdf7889"
let answer="";
for(let x of str){
if(!isNaN(x)) answer+=x;
}
console.log(answer)
출력 : 1231237889