-4

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

Axel
  • 4,365
  • 11
  • 63
  • 122

1 Answers1

0

This should do:

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