Академический Документы
Профессиональный Документы
Культура Документы
string using JavaScript. For all examples in this tutorial, we'll be using the following
string:
str.replace(/hello/, 'hi');
If you wish to search for Regular Expressions' reserved characters (i.e. -/\^$*+?.()|[]{}),
they will need to be escaped using a \ (back slash).
str.replace(/hello/g, 'hi');
str.replace(/hello/gi, 'hi');
str.split(/hello/i).join('hi');
// return string
return str;
replaceStr);
}
// usage:
str.replaceAll('hello', 'hi');
};
// usage:
str.replaceAll('hello', 'hi');