View Single Post
Old 09-27-2012, 10:57 PM   PM User | #1
webshark
New to the CF scene

 
Join Date: Sep 2012
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
webshark is an unknown quantity at this point
Find and replace multiple words with javascript

I am looking for a way to find and replace multiple words within a sentence using javascript. Ideally I would like to take a sentence and replace multiple words within that sentence i.e.

text **WORD 1** text | text **WORD 2** text

How can I replace both WORD1 and WORD2 with independent different words?

i.e.
WORD1= New-word-1
WORD2= New-word-2

here is the code:
http://jsfiddle.net/yaaf8/

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.
webshark is offline   Reply With Quote