JSFiddle - React, Tailwind, and code Playground

by dshilkret

JavaScript

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



// 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')");
//alert(subs);


var str = "This-is-a-blog-&-a-news-item-";
str = str.replace(/-/g, ' ').replace(/&/g, 'and');
alert(str);