I can't seem to find anything supporting this theory. In Javascript can I run a regular expression search and replace on an entire array?
For example:
Myarray[0] = "this is fun | what time is it? | the sky is blue|";
Myarray[1] = "Yahoo is fun | Answers are good | Go Saints |";
piper = /\|/g;
new_line = "\n";
Myarray[0] = Myarray[0] .replace(piper, new_line);
I want to search and replace all pipes with a newline character "\n". I then want all the arrays to read like this.
Myarray[0] = "this is fun
what time is it?
the sky is blue";
Myarray[1] = "Yahoo is fun
Answers are good
Go Saints ";
I keep getting an Object doesn't support this property or method. I have spent a good deal of time searching for a site that shows Array Search and Replace but to no avail.
2007-02-12
10:08:50
·
3 answers
·
asked by
topgun77
2
in
Computers & Internet
➔ Programming & Design