I need information about finding a word and replacing it with regular expressions in javascript.
2 Answers
Since you haven't really asked a question, the best I can do is point you here:
http://www.w3schools.com/jsref/jsref_obj_regexp.asp
And tell you also that the replace method for a string is replace, as in:
var myStr = "there is a word in here";
var changedStr = myStr.replace(/word/g, "replacement");
4 Comments
Sean Patrick Floyd
@Renesis: please, w3schools.com is awful, post a better link. How about this one: developer.mozilla.org/en/JavaScript/Reference/Global_Objects/…
Nicole
@Sean Patrick Floyd thanks for the other link. Not sure I agree that it's awful, even if it's usually light on explanation, it is a succinct reference for syntax.
Sean Patrick Floyd
@Renesis you can find some discussion about w3schools in this question: stackoverflow.com/questions/4312945/…
Nicole
@Sean - I don't see any discussion there - and again, when googling I don't often come up with any top 10 results that are as succinct as w3schools.