Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

143
Views
How to prevent bypass with markdown (Word blacklist system)

I've created a word-blacklist system that works decently, I remove all spaces from the message content, then use regex to match for blacklisted words, and if there's a match, delete the message.

const msgContent = message.content.replace(/\s/g, '');

let foundBlacklist = false;

for (const word of data.Words) {
   const regex = new RegExp(`${word}`, 'gi');
   if (regex.test(msgContent)) {
     foundBlacklist = true;
   }
}

if(foundBlacklist) message.delete().catch(err => console.log(`There was an error trying to delete that message: ${err}`))

The problem is that it's very easy to use markdown to bypass this, if bad is a blacklisted word, simply doing b*a*dto to make it italic, would make the message content b*a*d, and the regex won't match. This of course applies to underline, strikethrough ... etc, where b__ad__ or **b**ad etc won't match either.

How could this be prevented?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!