Well, as I said, you can do anything you want in your replacement handler! Only this time, we don't need
any of the parameters passed to our handler function.
js code:
var c;
string = string.replace(/!person/i, function() {
c = Math.floor((Math.random()*(Person.length-1)));
return Person[c];
});
From what I understand of your script now, you're working on a random sentence generator. The problem now is that you're replacing "!person" more than once and you need to find the correct conjugation of the verb for each instance of a person, which may be a tough challenge...