I am working with a long string on javasctipt and I have to replace substrings that I cant predetermine their length and value , where I can't use str.replace(/substr/g,'new string'), which doesn't allow replacing a substring that I can just determine its start position and its length.
Is there a function that I can use like string substr (string, start_pos, length, newstring) ?