question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

No Substring Filter?

See original GitHub issue

Hopefully I’m missing something or using the package incorrectly but seems like its not finding bad words as substrings…?

import Filter from 'bad-words';

const filter = new Filter();

console.log(filter.clean('xyz ass4ca')); // xyz ass4ca
console.log(filter.clean('xyz 555ass')); // xyz 555ass
console.log(filter.clean('xyz ass'));    // xyz ***

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:10

github_iconTop GitHub Comments

2reactions
daniandlcommented, Jan 29, 2021

It would be nice to at least have the option, as certain racial slurs do not really fit into any other words like Shitake 😃

1reaction
RADesaicommented, Apr 15, 2021
Bass. Assistant. Raccoon. Shitake mushrooms. Peacock.
B***. ***istant. Rac****. ****ake mushrooms. Pea****.

Is this really a good idea?

Fair point but for some use cases it can be desired, for example when we are generating random character serial numbers for item labels, we would like to filter any expletives that can be accidentally generated as as substring

Read more comments on GitHub >

github_iconTop Results From Across the Web

Filter list of strings, ignoring substrings of other items
A simple quadratic time solution would be this: res = [] n = len(lst) for i in xrange(n): if not any(i != j...
Read more >
Python | Filter list of strings based on the substring list
Given two lists of strings string and substr, write a Python program to filter out all the strings in string that contains string...
Read more >
Substring filter? - Google Groups
it contains the character at the index given for start and not the character given for end. And uses 0-based indexing. Probably not...
Read more >
Filter string not containing substring - Algolia Community
I have a page that loads products and applies a filter. There is a small number of products that I would like not...
Read more >
Solved: How to have better substring filter - Alteryx Community
It might be a little overkill, but perhaps a RegEx statement in a Filter Tool checking that there are no letters linking to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found