View Single Post
Old 09-27-2012, 11:11 PM   PM User | #2
xelawho
Senior Coder

 
xelawho's Avatar
 
Join Date: Nov 2010
Posts: 2,461
Thanks: 52
Thanked 457 Times in 455 Posts
xelawho will become famous soon enoughxelawho will become famous soon enough
possibly missing the point here, but...
Code:
var visitorName = "new word 1";
var loc = "here";
var myOldString = "Hello word1! I hope you enjoy your stay word2.";
var myNewString = myOldString.replace(/word1/g, visitorName).replace(/word2/g, loc);
?
xelawho is offline   Reply With Quote