-4

I want a Javascript regex to replace only numbers i.e. all others alphabets and special characters are allowed.

Axel
  • 2,577
  • 8
  • 37
  • 85

1 Answers1

0

This should do:

let string= "26kgsl5"
let newString = string.replace(/[0-9]/g, "");
console.log(newString);
Suhas
  • 500
  • 4
  • 11