Potential bug in `replace` function in `javascript-source/core/misc.js`

replace function in javascript-source/core/misc.js will cause an infinite loop if find is a substing of replace. E.g. replace('abc', 'b', 'bd') would keep expanding the string like abdc, abddc, …

Replaced it with new code in PR #2247

Thank you very much for your commitment. Reading the code, I’m wondering why you are not using RegExp or some built in function. I assume you have good reason to do so, I’m just curious.

This is faster, according to the benchmark linked in the comments