var value=" https://coupon.m.jd.com/coupons/show.action?linkKey=AAROH_xIpeffAs_-naABEFoeRj5ih0bA23YxmtwfSSDifkzn IcUlplZK0YZUCielDDaVo4lcBalYocgB4Zrb3QxWJZBqFAh\r\nhttp://coupon.m.jd.com/coupons/show.action?key=5cabb9bd9ed1449cb8675ee66b0f2bd8&roleId=55223240&to=item.jd.com/10033460458973.html"
var value=value.replace(/\ +/g,"").replace(/[\r\n]/g,"")
var lgsy=[];
var data=[];
var str = value
var index = str.indexOf('http');
var num = 0;
while(index !== -1) {
lgsy.push(index);
console.log(index);
num++;
index = str.indexOf('http',index + 1);
}
lgsy.push(value.length);
debugger
for(i=1;i<lgsy.length;i++){
if(lgsy.length==1){
data.push(lgsy[i])
}
else{
data.push(value.substr(lgsy[i-1],lgsy[i]))
}
}
console.log('http一共出现了' + num + '次');
console.log(JSON.stringify(data))
console.log(value.substr(146,276))
debugger
console