In postman, I want to change all occurrences of a slash to an underscore in my string.
So far I have written a test which parses the JSON response and pushes the string I want into an array, from this point my code looks like below
//an example string is below
var string = "1/7842/0889#001";
// convert / to _
var slash = "/";
var newstring = string.replace (slash, "_");
// This just changes the first occurrence of the slash to an underscore
I tried using the `g' modifier and this fails in Postman
var newstring = string.replace (/slash/g, "_");
I want the string to end up as
"1_7842_0889#001";