I have a text from a message in a varaible:
const text =
"I don't know @Dondes but it did. It's the highest scoring game in history.";
I have a regex to check the mention of a name: let regex ="\@\Dondes\b"
I would put the name to check into a variable and use it in the regex like this:
let test = "Dondes";
const userName = `\@\${test}}\b`;
And after that keep the name like that:
text.match(userName)
But it didn't work ^^ How can I do that?