Web Development

Regular expression replacement will always have a place. The fastest way to replace substrings on a string is to split and join like to following:

let ourString = "My name is Leon. Your name is not Leon";
ourString.split("Leon").join("Buddy"); // My name is Buddy. Your name is not Buddy"

Regular expressions will let you replace string with conditions easily

let partialString = ":pensive: will only be replaced if :p is not followed by ensive"
let stringToFind = new RegExp(/:p(?!ensive)/, 'g');
partialString = partialString.replace(stringToFind, ":stuck_out_tongue:"); // :pensive: will only be replaced if :stuck_out_tongue: is not followed by ensive

Another example:

let partialString = 'party party party p';
let stringToFind = new RegExp(/p(?!arty)/, 'g');
partialString = partialString.replace(stringToFind, "party"); // party party party party