-2

Hey I'm trying to remove numbers from a string using regex. this is my code so far:

str.replace(/[^\w\s]/gi, '');

this removes everything but letters and numbers, how can I change this regex to also remove digits? tried adding /d with no luck

that's not duplicate- none of the answers I saw worked for me. most of them were adding 0-9,A-Z stuff, nothing like the answers here.

thanks!

rio
  • 757
  • 5
  • 19
  • 32

1 Answers1

0

I tried str.replace(/\d/g, ''). It works for me.

Nikhil Vartak
  • 5,002
  • 3
  • 26
  • 32
stalkert
  • 26
  • 4
  • str.replace(/[^\w\s]|\d+/gi, ''); Best solution, the rest doesn't work as needed. thanks a lot @Wiktor Stribiżew – rio Oct 08 '18 at 19:21