How to replace values using regex
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-15-2014 06:44 AM
5 REPLIES 5
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-15-2014 06:50 AM
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.