Find and replace a set of substrings within a string. (javascript)
Utilisateur anonyme
function signature for replace is str.replace(regexp|substr, newSubstr|function), so we can do str.replace(/strToBeReplaced/g, targetString) to get the solution. Our regex might need to escape some characters if strToBeReplaced contains special characters like wildcards