Well, you can make a regular expression which does this, but you can't use that in a switch...case block.
code:
var reQuestion = /(^|\s)question(\s|$)/si; //Create a regular expression which contains the word "question".
if(reQuestion.test(Message)) { //Test the message on the regular expression
ChatWnd.SendMessage("Target valid!");
} else {
ChatWnd.SendMessage("Aborting, couldn't see target.");
}
Note that I made this regular expression so it'll match the
word "question" only. That means, it won't match "question
s". If you want it to match
any occurrence of "question", it gets much simpler. Then, you can simply use this instead of the original first line:
code:
var reQuestion = /question/i; //Create a regular expression which contains "question".
Note: In all these regular expressions, the "i" modifier was placed so they're case-insensitive. This is interesting if you capitalize the word for example. If you want it to be case-sensitive, just remove the "i" at the end.