JSFiddle - React, Tailwind, and code Playground

by dshilkret

JavaScript

// function you can use:
function getSecondPart(str) {
		function getSecondPart(str) {
    str = str.split('=')[1];
    str = str.split(',')[1];
    
}
    return str.split('=')[1];
}
function getNext(str) {
    return str.split(',')[1];
}

// use the function:
var subs = getSecondPart("https://splmdnw57xg3ppq.eastus2.cloudapp.azure.com/sites/ServiceNow/_api/web/getfilebyserverrelativeurl('/sites/ServiceNow/lib21/canvas.pdf')/copyTo(strNewUrl='/sites/ServiceNow/Lib22/canvas.pdf',bOverWrite=true)");
alert(subs);



// Replace the first instance of "How" with "Where"
const newString = subs.split(',')[0];

alert(newString);