Javascript Regular Expressions Replace all matched substrings with a new substring.

Description

Javascript Regular Expressions Replace all matched substrings with a new substring.


var searchString = "Now is the time, this is the tame"; 
var re = /t\w{2}e/g; 
var replacement = searchString.replace(re, "place"); 
console.log(replacement); // Now is the place, this is the place 



PreviousNext

Related