How to replace values using regex
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-15-2014 06:44 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-15-2014 06:47 AM
Tell me your requirement. I mean what you want to replace. For example, do you want your string to replace letters from alphanumeric values or else ??
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-15-2014 06:49 AM
Hi
I need to replace string with alphanumeric numbers.
Thank you in advance.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-15-2014 06:49 AM
If you already know the regex you want to use, you can just use the replace() method. For example, if you want to replace all spaces with dashes in a string you could use:
var str = "Replace the spaces";
gs.log(str.replace(/\s+/g, '-'));
Prints:
Replace-the-spaces
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-15-2014 06:51 AM
Thank you:)