If you're looking to accomplish this task, there are two methods you can choose from.
Option 1
You have the option to utilize either the split or join method:
var str = 'mobile)/index.m3u8';
var finalString = str.split(')/').join(' and ');
console.log(finalString);
Output: mobile and index.m3u8
Option 2
You can opt for using the replace method:
var str = 'mobile)/index.m3u8';
var finalString = str.replace(')/', ' and ');
console.log(finalString)
Output: mobile and index.m3u8
In my opinion, option 1 stands out as a superior choice because if the string )\
appears at multiple points, option 2 may not be effective.
var str = "mobile)/index)/.m3u8";
var finalString = str.replace(')/',' and ');
console.log(finalString);
Output - mobile and index)/.m3u8
var str = "mobile)/index)/.m3u8";
var finalString = str.split(')/').join(' and ');
console.log(finalString);
Output - mobile and index and .m3u8
This could prove to be quite beneficial for your needs.