replace character using regex
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-19-2016 05:51 AM
I have a string like Building\Floor\Space\
My requirement - I want to replace all '\' with ',' and then split the result like:
Building
Floor
Space
How this can be achieved?? Looks like ServiceNow does not recognize '\' as a regex.
Any lead will be appreciated. Thanks in advance!!
Labels:
5 REPLIES 5
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-19-2020 12:08 PM
Try something like this.
var str = mystring.replace(/"/g, '\'');
Please mark my response as correct and helpful if it helped solved your question.
-Thanks