var message = "hello [[xxx]] bye [[ZZZ]]"
var result, re = /\[\[(.*?)\]\]/g;
while ((result = re.exec(message)) != null) {
switch (result[1].toLowerCase()) {
case "xxx":
console.log("found xxx");
break;
case "zzz":
console.log("found zzz");
break;
}
}
This is an example of the code im using, currently it will output
found xxx
found zzz
Is there a way to put multiple ways to "trigger" a case? such as
case "xxx", "aaa", "bbb":
console.log("found 3xletters");
break;
I've tried this ^^^ but only the last thing can trigger it, so in the above case xxx and aaa wont trigger, but bbb will