Instead of guessing, try to check your codes!
@xsylvain2: eval() is evil, try to avoid using it.
@Spunky: The brackets will be recognized as a character set in a regular expression!
The correct way to use an array as replacement input, would look like:
code:
var data = new Array(":)", ":("); //This should contain your captured emoticons
for(i=0; i<data.length; i++) //Or shorter: for(i in data)
{
Message = Message.replace(new RegExp(data[i], "gi"), " "); //WARNING: See further[/i]
}
A note here is that the captured emoticon codes should be escaped before you use them in the regular expression. If I have some time, I could write a function which escapes the right characters and eventually return a regular expression so you don't even need the new RegExp(), but simply can use something like EscapeRegExp(data[i]). Send me a PM if you want me to start work on it.
And, could you please give us the full code and show us what exactly is in the data array? So we can better understand the structure you use in the script?