Censor failing to detect words containing regex symbols
I have a censor event that pulls the list of banned words, which may be preceded and/or followed by an * to mimic the Discord censor behavior. However, while I am escaping regex symbols before testing the word, my censor is failing to pick up words that contain regex symbols, and I can't for the life of me figure out why.
4 Replies
- What's your exact discord.js
npm list discord.js
and node node -v
version?
- Not a discord.js issue? Check out #other-js-ts.
- Consider reading #how-to-get-help to improve your question!
- Explain what exactly your issue is.
- Post the full error stack trace, not just the top part!
- Show your code!
- Issue solved? Press the button!
- ✅
Marked as resolved by OP
@SowerofSystems
Try this
dah one sec
This
That didn't fix it unfortunately. I is also failing to find partial words based on the *. The * were working correctly until I added the escapeRegExp, but I need it to make the censor find regex symbols as part of words, like shi+ for example.
Thanks @Qjuh, that was what I was missing. I also didn't need the $ or ^ nor the \b when the word starts and ends with *.