-2
var strIn = '.0.1.0.2.0.$1250638101358785130.$https=2//instagram=1fbom1-1=1fna=1fbcdn=1net/t51=12885-15/sh0=108/e35/p640x640/13116696_641288272691290_10643986_n=1jpg?ig_cache_key=0MTI1MDYzODEwMTM1ODc4NTEzMA%3D%3D=12.0.2',
    index = strIn.indexOf('https=2//instagram'),
    strOut = strIn.substr(index);

var res = strOut;
res = res.replace("=1", ".");
alert(res);

res = res.replace("=2", ":");
alert(res);

res = res.replace("jpg.2", "jpg");
console.log(res);
alert(res);

OpenInNewTab(res);
window.open('res','blank');

Help me with this code

res = res.replace("=1", ".");   <---This code Wont Work For me..

it is not changing "=1" with "."

talemyn
  • 7,822
  • 4
  • 31
  • 52

1 Answers1

1

You're not replacing all the instances of =1, only the first one. You can do it by turning the pattern into a regex and using the g flag.

res = res.replace(/=1/g, ".");

Do the same for your other replace operations.

James Buck
  • 1,640
  • 9
  • 13