Utilizing https://www.npmjs.com/package/bad-words, I have created a regex to filter out special characters.
const Filter = require('bad-words');
const badWordsFilter = new Filter({replaceRegex: /[A-Za-z0-9öÖÇ窺ĞğİıÜü_]/g});
badWordsFilter.addWords(['badword', 'şğ'])
The filtering works when the word does not contain Turkish characters. However, when Turkish characters like ş or ğ are included, it does not filter them out.
Is there an issue with my regex?
I came across this code in the documentation:
var filter = new Filter({ regex: /\*|\.|$/gi });
var filter = new Filter({ replaceRegex: /[A-Za-z0-9가-힣_]/g });
//multilingual support for word filtering