Answers for "javascript regular expression replace ' ) '"

9

how to use the replace method in javascript

let string = 'soandso, my name is soandso';

let replaced = string.replace(/soandso/gi, 'Dylan');

console.log(replaced); //Dylan, my name is Dylan
Posted by: Guest on April-15-2020
3

javascript regex replace

const search = 'duck'
const replaceWith = 'goose';

const result = 'duck duck go'.replaceAll(search, replaceWith);

result; // => 'goose goose go'
Posted by: Guest on June-23-2020
0

javascript replace without replace()

function fakeReplace(data, substr, newstr) {
    return data.map(function(s) {
       return s.split(substr).join(newstr);
    })
}
Posted by: Guest on September-04-2020

Code answers related to "javascript regular expression replace ' ) '"

Code answers related to "Javascript"

Browse Popular Code Answers by Language