view raw
Tarek Salah uddin Mahmud Tarek Salah uddin Mahmud - 7 months ago 44
Javascript Question

Replace an expression in string using javascript

I have a string that has some numbers in the middle of the string.

For example,

var str = ""

I want to remove the numbers like this

I am not trying to replace all numbers.

I have to replace only
expression with

How do I do this in JavaScript?

var str = ""    
str = str.replace(/-[0-9]*/g, '')