Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
09-27-2012, 10:57 PM #1
- Join Date
- Sep 2012
- Thanked 0 Times in 0 Posts
text **WORD 1** text | text **WORD 2** text
How can I replace both WORD1 and WORD2 with independent different words?
here is the code:
and to take it one step further I would like to pull new word values from an excel sheet, run a loop with the new words to be replaced and have the output of the new sentences all on one page.
Any guidance would be greatly appreciated.
09-27-2012, 11:11 PM #2
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);
09-28-2012, 08:03 AM #3
- Join Date
- Jun 2002
- London, England
- Thanked 2,531 Times in 2,509 Posts
The whole aim of practical politics is to keep the populace alarmed (and hence clamorous to be led to safety)by menacing it with an endless series of hobgoblins, all of them imaginary. - H.L. Mencken 1880-1956, American Editor, Author, Critic, Humorist
Last edited by Philip M; 09-28-2012 at 08:15 AM.
All the code given in this post has been tested and is intended to address the question asked.
Unless stated otherwise it is not just a demonstration.