Get a first look at what's coming. The Developer Passport Australia Release Preview kicks off March 12. Dive in! 

How to replace values using regex

lakshmir
Giga Contributor

Hi All,

Can somebody help me how to replace values using regex

5 REPLIES 5

rezacol
Mega Expert

As of one example, where I want to keep only numeric data on a string:


var oldValue = '438tgg786786gyg76


var newValue = oldValue.replace(/[^0-9]/ig, "");



The new value will contain only '43878678676'.



Hope this helps!



thanks,


Reza R.