1var myStr = 'this,is,a,test';
2var newStr = myStr.replace(/,/g, '-');
3
4console.log( newStr ); // "this-is-a-test"
1$('#id1 p').each(function() {
2 var text = $(this).text();
3 $(this).text(text.replace('Kate', 'Nef'));
4});
1$(".text_div").text(function () {
2 return $(this).text().replace("contains", "hello everyone");
3});