replace character using regex

kunal16
Tera Expert

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!!

5 REPLIES 5

Try something like this.

var str = mystring.replace(/"/g, '\'');

Please mark my response as correct and helpful if it helped solved your question.
-Thanks